I am currently trying to save an Array of Dictionaries to NSUserDefaults. I originally planned to have the type be Array<Dictionary<String,String>>
but that does not appear to be the case here.
To start, I am getting the String values from the following UI objects:
@IBOutlet weak var name: UITextField!
@IBOutlet weak var instructor: UITextField!
@IBOutlet weak var time: UIDatePicker!
And then saving it into a Dictionary like so:
let values = ["name" : self.name.text, "instructor" : self.instructor.text, "date" : self.time.date.description]
However the Dictionary's type is inferred as Array<Dictionary<String,String!>>
not Array<Dictionary<String,String>>
. The problem seems to be that self.name.text
and self.instructor.text
returns String!, but self.time.date.description
returns String.
I think it would be possible to ignore these and continue on, but I want to understand what is going on here rather than continue and hope it doesn't break something in the future.