http://stackoverflow.com/questions/39514375/cggradient-issues-with-swift-3
Get Outlook for iOS
_____________________________
From: Charles Jenkins <[email protected]>
Sent: Tuesday, November 22, 2016 7:18 PM
Subject: Swift 3: How to Create CFArray of CGColors?
To: Cocoa-Dev (Apple) <[email protected]>
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 protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]