Instantly share code, notes, and snippets.

Embed
What would you like to do?
App State
enum Result {
case loading
case failed
case finished(LocationPlaces)
}
extension Result: Equatable {
static func == (lhs: Result, rhs: Result) -> Bool {
switch (lhs, rhs) {
case (.loading, .loading):
return true
case let (.finished(a), .finished(b)):
return a == b
case (.failed, .failed):
return true
default:
return false
}
}
}
struct FetchedPlacesState: StateType {
var places: Result = .loading
}
extension FetchedPlacesState: Equatable {
static func == (lhs: FetchedPlacesState, rhs: FetchedPlacesState) -> Bool {
return lhs.places == rhs.places
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment