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:
-
Extract the else clause into a function named hideBlurView. Slide it down into the extension, then declare it in the ChangePasswordViewCommands protocol.
-
Extract the if clause into a function named showBlurView. Slide it into the extension and declare it in the protocol.
-
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.