Impressia/Vernissage/Models/ViewState.swift

27 lines
589 B
Swift
Raw Normal View History

2023-02-01 18:40:28 +01:00
//
// https://mczachurski.dev
// Copyright © 2023 Marcin Czachurski and the repository contributors.
2023-03-28 10:35:38 +02:00
// Licensed under the Apache License 2.0.
2023-02-01 18:40:28 +01:00
//
2023-02-01 18:40:28 +01:00
import Foundation
public enum ViewState: Equatable {
case loading
case loaded
case error(Error)
static public func == (lhs: ViewState, rhs: ViewState) -> Bool {
2023-02-01 18:40:28 +01:00
switch (lhs, rhs) {
case (.error, .error):
return true
case (.loaded, .loaded):
return true
case (.loading, .loading):
2023-02-01 18:40:28 +01:00
return true
default:
return false
}
}
}