How to use NSUserDefaults to store an array of dictionaries
Trying to store an array of dictionaries with NSUserDefaults . var theTasks: [[String:Any]] = [["num":1,"title":"example","colour":"red"]] let defaults = NSUserDefaults.standardUserDefaults() defaults.setObject(theTasks, forKey: "myTasks") defaults.synchronize() let selected = theTasks[1] Gives error: Cannot convert value of type '[[String:Any]]' to expected argument of type 'AnyObject?' Swift 3.x In Swift 3 it has changed so now it needs to be saved as [Any] Any Array and use UserDefaults array(forKey:) method to load it: let theTasks: [Any] = [["num": 1, "title": "example", "colour": "red"]]