Can I access a struct inside of an array that is defined in the application delegate from a ViewController?
I get the error: 'Any' does not have a member named 'title' in XCode 6.2
What is the syntax for accessing a structure inside of the array?
//AppDelegate.swift import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? struct TodoItem { var title: String } var todoItem = TodoItem( title: "Get Milk") var myArray: [Any] = [] And then in the ViewController
// // ViewController.swift import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let delegate = UIApplication.sharedApplication().delegate as AppDelegate //here I'm adding the struct to the array let myTodoItem = delegate.myArray.append(delegate.todoItem) //how do I access the items in the struct? println(delegate.myArray[0].title)