Remove the didSet Observer

Having moved handleSuccess from the view controller to the presenter, it would be nice to do the same for handleFailure. But its alert action calls startOver, which touches several view model properties. So let’s shift the effects of those properties into View Commands.

Let’s follow the same refactoring steps we used in Move Functionality out of the View Model, applying them to updateBlurView:

  1. Extract the else clause into a function named hideBlurView. Slide it down into the extension, then declare it in the ChangePasswordViewCommands protocol.

  2. Extract the if clause into a function named showBlurView. Slide it into the extension and declare it in the protocol.

  3. Comment out the call to hideBlurView. Add the ...

Get iOS Unit Testing by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.