1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00
persephone/Persephone/Models/Loading.swift

29 lines
509 B
Swift

//
// Loading.swift
// Persephone
//
// Created by Daniel Barber on 2019/4/27.
// Copyright © 2019 Dan Barber. All rights reserved.
//
import Foundation
enum Loading<T> {
case notLoaded
case loading
case loaded(T)
case error(Error)
static func ~= (lhs: Loading<T>, rhs: Loading<T>) -> Bool {
switch (lhs, rhs) {
case (_, .notLoaded),
(.loading, .loading),
(.loaded, .loaded),
(.error, .error):
return true
default:
return false
}
}
}