This in Objective-C returns the default iOS disabled gray color:
[UIColor colorWithWhite: 0.70 alpha:1];
There doesn't appear to be any native Swift function:
UIColor.colorWithWhite(0.70, alpha: 1)
I'm wondering if there's a different way that UIColor has implemented this in Swift that I'm not aware of? I can't seem to find anything in the docs. If not, then what would be an appropriate extension
for this method?
In Swift it's all about readability and most of the static methods calls known from Objective-C are dropped now.
[UIColor colorWithWhite:alpha]
is now UIColor(white: CGFloat, alpha: CGFloat)
UIColor(white: 0.7, alpha: 1.0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With