この単純な JSON がありますが、ObjectMapper を使用してマップできません
{"response":404}
これが私がやっている方法です
import Foundation
import UIKit
import ObjectMapper
class YASEmail: Mappable {
var response: String
required init?(_ map: Map) {
response = ""
}
func mapping(map: Map) {
response <- map["response"]
}
}
これが私がマッピングしようとしている方法です
if let response = Mapper<YASEmail>().map(result) {
print(response)
}