Reputation: 72915
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?
Upvotes: 4
Views: 2934
Reputation: 1205
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)
Upvotes: 9