mirror of
https://github.com/bitwarden/ios.git
synced 2025-12-13 02:58:59 -06:00
24 lines
536 B
Swift
24 lines
536 B
Swift
import Foundation
|
|
import SwiftUI
|
|
|
|
// MARK: - LoadingState
|
|
|
|
/// An enumeration of the possible loading states for any screen with a loading state.
|
|
enum LoadingState<T: Equatable>: Equatable {
|
|
/// The data that should be displayed on screen.
|
|
case data(T)
|
|
|
|
/// The view is loading.
|
|
case loading(T?)
|
|
|
|
/// The data to be displayed, if the case is `data`.
|
|
var data: T? {
|
|
switch self {
|
|
case let .data(data):
|
|
data
|
|
case let .loading(maybeData):
|
|
maybeData
|
|
}
|
|
}
|
|
}
|