Re: Swift 3: How to Create CFArray of CGColors?
Re: Swift 3: How to Create CFArray of CGColors?
- Subject: Re: Swift 3: How to Create CFArray of CGColors?
- From: Eric Dolecki <email@hidden>
- Date: Wed, 23 Nov 2016 00:23:15 +0000 (UTC)
http://stackoverflow.com/questions/39514375/cggradient-issues-with-swift-3
Get Outlook for iOS
_____________________________
From: Charles Jenkins <email@hidden>
Sent: Tuesday, November 22, 2016 7:18 PM
Subject: Swift 3: How to Create CFArray of CGColors?
To: Cocoa-Dev (Apple) <email@hidden>
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
_______________________________________________
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