I declare a global variable in my first view controller:
import UIKit
import QuartzCore
var searchResults = [SearchResult]()
class HomeSearchViewController: UIViewController {
print(searchResults.count) will print 18
However in my second view controller:
override func viewDidLoad() {
super.viewDidLoad()
print(searchResults.count)
prints nothing. The views are connected via a Tab Bar VC. I don’t want to subclass the Tab Bar or use AppDelegate to pass the data.
Thanks.