Skip to content

Instantly share code, notes, and snippets.

@ysam12345
Created January 9, 2019 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ysam12345/ff963cb78798a0cbfa16538065268eba to your computer and use it in GitHub Desktop.
Save ysam12345/ff963cb78798a0cbfa16538065268eba to your computer and use it in GitHub Desktop.
func loadNotificationList() {
let url = URL(string: "http://140.121.197.197:3000/getUserNotificationList?facebook_token="+userData!.facebookAccessToken)!
let task = URLSession.shared.dataTask(with: url) { (data, response , error) in
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601
if let data = data, let results = try?
decoder.decode(NotificationListData.self, from: data)
{
print("json load success")
print(results)
self.mapView.removeAnnotations(self.mapView.annotations)
self.mapView.removeOverlays(self.mapView.overlays)
self.notificationListData = results
for var i in results.data {
self.addPointAndCircleToMapView(lat: i.data.lat, lon: i.data.lon, radius: i.data.radius, content: i.data.content)
}
} else {
print("error")
}
}
task.resume()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment