[Solved] Why is this out of index?


Not sure what this is:

var mainController = ViewController()
var movie = ViewController().self.movieArray[0]

Regardless, ViewController() instantiates a new object of that class. At that point, it’s very likely movieArray has never been initialized and has no objects in it.

5

solved Why is this out of index?