• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Swift 3: How to Create CFArray of CGColors?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Swift 3: How to Create CFArray of CGColors?


  • Subject: Swift 3: How to Create CFArray of CGColors?
  • From: Charles Jenkins <email@hidden>
  • Date: Tue, 22 Nov 2016 19:17:58 -0500

I’m sure this will turn out to be elementary, but the Apple documentation
of CFArray is so EMPTY that I can’t seem to figure it out.

I have this line of code:

let gradient = CGGradient( colorsSpace: CGColorSpaceCreateDeviceRGB(),
colors: [ clearWhite.cgColor, clearWhite.cgColor,
clearWhite.blendedColorWithFraction(0.5, ofColor: white).cgColor,
white.cgColor ], locations: [0, 0.57, 0.93, 1])

The array of colors is no longer legal in Swift 3. I get an error
message—“Contextual type CFArray cannot be used with an array
literal”—which I think is saying I must pass a CFArray.

Despite Xcode crashing every few minutes while I’m typing, I was able to
create a CFMutableArray object, but then I get an error when trying to add
the colors because they aren’t unsafe pointers.

How can I convert my array to the needed CFArray?

--

Charles
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Swift 3: How to Create CFArray of CGColors?
      • From: Quincey Morris <email@hidden>
    • Re: Swift 3: How to Create CFArray of CGColors?
      • From: Eric Dolecki <email@hidden>
  • Prev by Date: Re: CABasicAnimation in a view that's covered by another?
  • Next by Date: Re: Swift 3: How to Create CFArray of CGColors?
  • Previous by thread: Re: CABasicAnimation in a view that's covered by another?
  • Next by thread: Re: Swift 3: How to Create CFArray of CGColors?
  • Index(es):
    • Date
    • Thread