JSONModel does not work with Swift arrays

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?

+1
source share
1 answer

JSONModel Swift - , Obj-C. JSONModel . .

, JSONModel , , .. , Swift, - JSONModel .

:

  • JSONModel JSON (de) Swift
  • Objective-C

, , , JSONModel.

+1

All Articles