func loadDataFromAmplify() {
print("LOAD ~ FROM ~ AMPLIFY")
do {
Amplify.DataStore.query(FishingSpot.self) { result in
switch result {
case .success(let spots):
for spot in spots {
print(spot)
}
case .failure(let error):
print(error)
}
}
}
}
Amplify.DataStore.query(FishingSpot.self)
這段,呼叫了 Amplify.DataStore 模組所提供的 query 方法,試圖在 「FishingSpot表格」取回所有的資料列。PinLocation
和 FishPinAnnotation
這兩種 struct,分別是因為