August 2016
Intermediate to advanced
1027 pages
23h 11m
English
Let's move on to populating the View Controller we just created with the proper entities.
The first thing we need to do is create entities, which is really straightforward. Basically, we just need to map the requested fields in struct:
import Foundation
struct Todo: Equatable {
let description: String
let list: List
let dueDate: NSDate
let done: Bool
let doneDate: NSDate?
}
func ==(todo1: Todo, todo2: Todo) -> Bool {
return todo1.description == todo2.description
&& todo1.dueDate == todo2.dueDate
}
struct List {
let description: String
}
Foundation is the core module in Swift, and it contains fundamental objects, for example, NSDate, which is required to implement every kind of app.
Read now
Unlock full access