回答編集履歴

1

s

2018/06/26 23:47

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -90,4 +90,24 @@
90
90
 
91
91
  }
92
92
 
93
+
94
+
95
+ // Encode
96
+
97
+ let point1 = Locations.Location(points: Locations.Location.Point(lat: 123.111, lng: 456.222, height: 50.0))
98
+
99
+ let point2 = Locations.Location(points: Locations.Location.Point(lat: 789.888, lng: 22.666, height: 30.0))
100
+
101
+ let locations1 = Locations(plan: [point1, point2])
102
+
103
+
104
+
105
+ let encoder = JSONEncoder()
106
+
107
+ encoder.outputFormatting = .prettyPrinted
108
+
109
+ let encoded = try! encoder.encode(locations1)
110
+
111
+ print(String(data: encoded, encoding: .utf8)!)
112
+
93
113
  ```