Avatar
omochimetaru 4/27/2017 2:55 AM
let farm = Farm(name: "Old MacDonald's Farm", location: Location(latitude: 51.621648, longitude: 0.269273), animals: [.chicken, .dog, .cow, .turkey, .dog, .chicken, .cow, .turkey, .dog]) let payload: Data = try JSONEncoder().encode(farm) 使い方がこうだから、JSONEncoderが内部でfarmのencodeメソッドを呼ぶのか。