O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Model

We will start by creating our model. The code is as follows:

import Vapor import Fluent final class Todo: Model {     var id: Node?     var todoId: Int     var name: String     var description: String     var notes: String     var completed: Bool     var synced: Bool     var exists: Bool = false     init(node: Node, in context: Context) throws {         id = try node.extract("id")         todoId = try node.extract("todoId")         name = try node.extract("name")         description = try node.extract("description")         notes = try node.extract("notes")         completed = try node.extract("completed")         synced = try node.extract("synced")     }     init(todoId: Int, name: String, description: String, notes: String,            completed: Bool, synced: Bool) {         self.todoId = todoId         self.name = name  self.description ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required