Step #2: Improving the Motor

We need to be able to save changes from EditFragment. We already have logic in ToDoRepository for this, in the form of a save() function that we used from RosterMotor. However, EditFragment is using SingleModelMotor, which right now lacks a save() function.

So… let’s add it!

Add this save() function to SingleModelMotor, perhaps by copying it from RosterMotor:

  fun save(model: ToDoModel) {
    repo.save(model)
  }

Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.