Guest User

Untitled

a guest
Oct 15th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. func extractStationData(){
  2. for article in blog.articles {
  3. article.href
  4.  
  5. }
  6. }
  7.  
  8. let stationDataURL = "https://api.citybik.es(extractStationData())"
  9.  
  10. let networksURL = "https://api.citybik.es/v2/networks/"
  11. guard let dataURL = URL(string: networksURL) else {return}
  12.  
  13. URLSession.shared.dataTask(with: dataURL) { (data, response, err) in
  14.  
  15. guard let data = data else {return}
  16. let dataAsString = String(data: data, encoding: .utf8)
  17.  
  18. guard let blog = try? JSONDecoder().decode(Blog.self, from: data) else {
  19. print("Error: Couldn't decode data")
  20. return
  21. }
  22.  
  23. print("Networks link:")
  24. for article in blog.articles {
  25. print("- (article.href)")
  26. }
Add Comment
Please, Sign In to add comment