The Swift documentation says that adding initializers in an extension is possible, and the example in the document is about adding an initializer to a struct. Xcode doesn't recognize UIColor
's designated initializer in my convenience initializer:
extension UIColor {
convenience init(rawValue red: CGFloat, green g: CGFloat, blue b: CGFloat, alpha a: CGFloat) {
// Can not find out the designated initializer here
self.init()
}
}
Any solutions?