From the course: iOS Development: Architecture

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implementing one-way binding, part 2

Implementing one-way binding, part 2

From the course: iOS Development: Architecture

Start my 1-month free trial

Implementing one-way binding, part 2

- [Instructor] Now let's switch to the view model class. I need to change the type of the my model property from model date to model observable date. We need now to refactor the add entry method. First I create a constant named date observable. Which is an observable instance that takes a value of type date. And, I paste this to the my model insert method. Next we have to assign our closure to the bind property. Whenever the observed value changes, this closure gets involved. I'm going to update the table view to show the new value. Since we can't access the table view directly we'll be firing a notification. I'm going to rely on notification center and we'll post a dedicated notification. I have to provide the notification name as a raw value. Alright? Next we need to listen to this notification in the master view controller. I readjusted the view model notification in the view did load delegate method. We'll add an observer. We need the very end which has a completion block, this…

Contents