Advertisement
Guest User

Untitled

a guest
May 24th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. import UIKit
  2.  
  3. import SwiftyJSON
  4.  
  5. class TableViewController: UITableViewController {
  6.  
  7.  
  8. var cities = ["Minsk", "Madrid", "Riga"]
  9. var weather: [String] = []
  10.  
  11. override func viewDidLoad() {
  12.  
  13. super.viewDidLoad()
  14. }
  15.  
  16.  
  17. func getJSONData(){
  18.  
  19. let file = NSBundle.mainBundle().pathForResource("JSONData", ofType: "json") as String!
  20.  
  21. let data = NSData(contentsOfFile: file) as NSData!
  22.  
  23. let clearJSON = JSON(data: data, options: NSJSONReadingOptions.MutableContainers, error: nil)
  24.  
  25. let numberOfEuropeCities = clearJSON["Europe"].count
  26.  
  27. for i in 0..< numberOfEuropeCities {
  28.  
  29. weather.append(clearJSON["Europe", cities[i], "weather"].string!)
  30.  
  31. //Error: expected '{' to start the body of for-each loop
  32. //Error: Braced block of statements is an unused closure
  33.  
  34. }
  35.  
  36. }
  37.  
  38. for i in 0 ..< numberOfEuropeCities
  39.  
  40. for i in 0..<numberOfEuropeCities {
  41.  
  42. for i in 0 ..< numberOfEuropeCities {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement