
Maintaining State in Your ViewControllers – Swift - Liriel
https://mecid.github.io/2019/01/23/maintaining-state-in-view-controllers/
======
Chazprime
This is a pattern that I've started using everywhere and it's incredibly
useful. The common closure format of:

    
    
      (T?, Error?) -> ()
    

means you have possibly four different options for the return value, it's much
simpler to represent as:

    
    
      enum Result<T> {
          case success(T)
          case error(Error)
      }
    
    

Here's a great read about how Swift enums are algebraic sum types:

[https://mislavjavor.github.io/2017-04-19/Swift-enums-are-
sum...](https://mislavjavor.github.io/2017-04-19/Swift-enums-are-sum-
types.-That-makes-them-very-interesting/)

