我試圖將我的應用程序遷移到Swift 3,但我有麻煩。擴展錯誤Swift 3 JSON
是奮鬥我的代碼段是:
extension JSON: Swift.BooleanType {
//Optional bool
public var bool: Bool? {
get {
switch self.type {
case .bool:
return self.object.boolValue
default:
return nil
}
}
set {
if newValue != nil {
self.object = NSNumber(value: newValue! as Bool)
} else {
self.object = NSNull()
}
}
}
在第一行就是Xcode中拋出一個錯誤:
extension JSON: Swift.BooleanType {
錯誤說:Inheritance from non-protocol type 'BooleanType' (aka 'Bool')
有誰知道發生了什麼那裏?
沒有任何反應,它會引發同樣的問題 –