回答編集履歴
1
s
answer
CHANGED
@@ -44,4 +44,14 @@
|
|
44
44
|
print(location.points.height)
|
45
45
|
}
|
46
46
|
}
|
47
|
+
|
48
|
+
// Encode
|
49
|
+
let point1 = Locations.Location(points: Locations.Location.Point(lat: 123.111, lng: 456.222, height: 50.0))
|
50
|
+
let point2 = Locations.Location(points: Locations.Location.Point(lat: 789.888, lng: 22.666, height: 30.0))
|
51
|
+
let locations1 = Locations(plan: [point1, point2])
|
52
|
+
|
53
|
+
let encoder = JSONEncoder()
|
54
|
+
encoder.outputFormatting = .prettyPrinted
|
55
|
+
let encoded = try! encoder.encode(locations1)
|
56
|
+
print(String(data: encoded, encoding: .utf8)!)
|
47
57
|
```
|