[swift-users] Initializing a UIColor

Chris Lattner clattner at apple.com
Wed May 11 23:56:37 CDT 2016


> On May 11, 2016, at 7:37 AM, Erica Sadun via swift-users <swift-users at swift.org> wrote:
> 
>> 
>>> On May 11, 2016, at 9:57 AM, Dennis Weissmann <dennis at dennisweissmann.me <mailto:dennis at dennisweissmann.me>> wrote:
>>> 
>>> Huh! There’s a new overload for that initializer:
>>> 
>>> <Screen Shot 2016-05-11 at 3.52.34 PM.png>
>>> 
>>> The one that takes CGFloats is the one that was there before, but the one taking Floats is new!
>>> 
>>> You can work around like this:
>>> 
>>> let color = UIColor(red: CGFloat(0.892), green: CGFloat(0.609), blue: CGFloat(0.048),  alpha: CGFloat(1.000))
>>> or
>>> let color = UIColor(red: Float(0.892), green: Float(0.609), blue: Float(0.048),  alpha: Float(1.000))
>>> 
>>> - Dennis
> 
> 
> Wow, that's a ridiculous situation to have.  Who uses Float with iOS/tvOS anyway? 
> 
> I created a workaround, but I hate it:

This is a known regression that is a fallout of the changes to playground literals, it is high priority to get fixed.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160511/842e4833/attachment.html>


More information about the swift-users mailing list