// Pseudocode // Problems: // - no cached state // - can't display error over existing content // - not easily reusable // Is less verbose, perhaps quicker to understand. class ViewController { enum State { case loading case success(JSON?) case failure(Error?) } var state: State { didSet { updateTheUI() } } init { load() } func load() { state = .loading async { loadData { data, error in if let json = JSON(data) { self.state = .success(json) } else { self.state = .failure(error ?? ParsingError()) } } } } func updateTheUI() { // Handle the state enum to draw correct UI } }