Pass variables from one ViewController to another in Swift

In Swift, everything is public by default.
Define your variables outside the classes:

import UIKit

var placesArray: NSMutableArray!

class FirstViewController: UIViewController {
//
..
//
}

and then access it

import UIKit

class TableViewController: UITableViewController {
//
placesArray = [1, 2, 3]
//
}

Leave a Comment