ios-picker-dialog
ios-picker-dialog copied to clipboard
Possibly missing UIColor extension
Hey,
Thank you for creating this utility, it's quite neat.
I encountered an error while trying it out.
In your file, you have made use of the UIColor with the following constructor
UIColor(hex: intValueHere)
However that is not a valid overload(it's not in UIKit), so I assume you where using some kind of extension. I managed to patch it up for my use by adding the following extension.
extension UIColor {
convenience init(hex: Int, alpha: Float = 1.0){
let r = Float((hex >> 16) & 0xFF)
let g = Float((hex >> 8) & 0xFF)
let b = Float((hex) & 0xFF)
self.init(red: CGFloat(r / 255.0), green: CGFloat(g / 255.0), blue:CGFloat(b / 255.0), alpha: CGFloat(alpha))
}
}
I am doing something wrong and xcode was throwing erros on the original code? I am new to the whole OSX/iOS ecosystem, so I am not quite familiar with the standard libraries
Hey @PeteShag - I'm not sure how I missed this notification.. but yes, you're right! I did accidentally include the hex extension in this project, nothing wrong on your part.