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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.