mirror of
https://github.com/jeremysrand/ListenerApp.git
synced 2025-03-12 00:11:29 +00:00
29 lines
422 B
Swift
29 lines
422 B
Swift
|
import Foundation
|
||
|
|
||
|
public enum Result {
|
||
|
case success
|
||
|
case failure(Error)
|
||
|
|
||
|
public var isSuccess: Bool {
|
||
|
switch self {
|
||
|
case .success:
|
||
|
return true
|
||
|
case .failure:
|
||
|
return false
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public var isFailure: Bool {
|
||
|
return !isSuccess
|
||
|
}
|
||
|
|
||
|
public var error: Error? {
|
||
|
switch self {
|
||
|
case .success:
|
||
|
return nil
|
||
|
case .failure(let error):
|
||
|
return error
|
||
|
}
|
||
|
}
|
||
|
}
|