I am having problems using JSONModel in Swift.
I am trying to create a ToDo list application that would save a collection of elements so that ToDo elements persist when the application closes. This is the code I'm using:
class ToDoItem: JSONModel {
var name: String = ""
var isCompleted: Bool = false
var createdOn: NSDate = NSDate()
}
class ToDoList: JSONModel {
var items: [ToDoItem] = []
}
I can convert ToDoItemto JSON by calling toJSONString(), but the same method does not work with ToDoList, it returns nil. Any idea why this is happening?
source
share