这是我的示例代码,它带来了我的问题:
protocol Decodable {
init?(json: [String: AnyObject]) // remove this line will solve the problem
}
extension UIFont: Decodable { // remove `Decodable` will also solve the problem
convenience init?(json: [String: AnyObject]) { // Error: Initialiser requirement 'init(json:)' can only be satisfied by a `required` initializer in the definition of non-final class 'UIFont'
self.init(name: "whatever", size: 10)
}
}
上面的代码使用Xcode 7.3& Swift 2.2
任何人都知道这个错误,为什么与协议定义的方法存在某种关系?