I am trying to fix all my projects after a quick update 2.0. After some work, I narrowed it down to this one mistake:
Cannot invoke map using argumet type list ([AnyObject], (_) → _)
This is all the code:
extension JSON {
public var array: [JSON]? {
get {
if self.type == .Array {
return map(self.object as! [AnyObject]){ JSON($0) }
} else {
return nil
}
}
}
public var arrayValue: [JSON] {
get {
return self.array ?? []
}
}
public var arrayObject: [AnyObject]? {
get {
switch self.type {
case .Array:
return self.object as? [AnyObject]
default:
return nil
}
}
set {
if newValue != nil {
self.object = NSMutableArray(array: newValue!, copyItems: true)
} else {
self.object = NSNull()
}
}
}
}
The error appears here:
return map(self.object as! [AnyObject]){ JSON($0) }
Any ideas? My quick knowledge doesn't go that far ...
source
share