[swift-users] Initializing a UIColor
Dennis Weissmann
dennis at dennisweissmann.me
Wed May 11 08:57:45 CDT 2016
Huh! There’s a new overload for that initializer:
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
> On May 11, 2016, at 3:46 PM, Charles Lane via swift-users <swift-users at swift.org> wrote:
>
> The following code worked fine in previous development snapshots but fails in the May 9, 2016 snapshot:
>
> let color = UIColor(red: 0.892, green: 0.609, blue: 0.048, alpha: 1.000)
>
> Does anyone know whether this is a bug or if the syntax changed? (Yes, I imported UIKit). Xcode gives an error of ‘Ambiguous use of init(red:green:blue:alpha:)’
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160511/590658db/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-05-11 at 3.52.34 PM.png
Type: image/png
Size: 50135 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160511/590658db/attachment.png>
More information about the swift-users
mailing list