Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import SwiftyJSON
- class TableViewController: UITableViewController {
- var cities = ["Minsk", "Madrid", "Riga"]
- var weather: [String] = []
- override func viewDidLoad() {
- super.viewDidLoad()
- }
- func getJSONData(){
- let file = NSBundle.mainBundle().pathForResource("JSONData", ofType: "json") as String!
- let data = NSData(contentsOfFile: file) as NSData!
- let clearJSON = JSON(data: data, options: NSJSONReadingOptions.MutableContainers, error: nil)
- let numberOfEuropeCities = clearJSON["Europe"].count
- for i in 0..< numberOfEuropeCities {
- weather.append(clearJSON["Europe", cities[i], "weather"].string!)
- //Error: expected '{' to start the body of for-each loop
- //Error: Braced block of statements is an unused closure
- }
- }
- for i in 0 ..< numberOfEuropeCities
- for i in 0..<numberOfEuropeCities {
- for i in 0 ..< numberOfEuropeCities {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement