I have downloaded the 'GeoJSON' pod via Cocoapods. But when I try to run my app I recieve following error.
Error : Contextual type 'AnyObject' cannot be used with dictionary literal. (Image)
public var dictionaryRepresentation: [String: Any] {
return [
"geometry": [
"coordinates": self.geometryCoordinates,
"type": type(of: self).type
],
"type": "Feature",
"properties": [:]
]
}
I solved it like this
public var dictionaryRepresentation: [String: Any] {
return [
"geometry": [
"coordinates": self.geometryCoordinates,
"type": Self.type
] as [String: Any],
"type": "Feature",
"properties": [:]
]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.