-
Notifications
You must be signed in to change notification settings - Fork 2
Setters
Jeff Hurray edited this page Apr 25, 2016
·
2 revisions
All models conforming to SQLiteModel have a static method called set which will set the value associated with a column.
myMovie.set(Movie.Title, "new title")You can also use the <| and |> operators for some syntactic sugar.
myMovie <| Movie.Title |> "new title"All non-relationship sets are inserted into a cache and are O(1) operations. The changes will not be reflected in the database unless the save method of that instance is called.
You can add a little more syntactic sugar to your models with dynamic variables:
extension Movie {
var title: String {
get {
return self => Movie.Title
}
set {
self <| Movie.Title |> newValue
}
}
}SQLiteModel