diff options
| -rw-r--r-- | ios/MullvadVPN/Promise/PromiseCompletion.swift | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ios/MullvadVPN/Promise/PromiseCompletion.swift b/ios/MullvadVPN/Promise/PromiseCompletion.swift index bfa7acca95..65499ed021 100644 --- a/ios/MullvadVPN/Promise/PromiseCompletion.swift +++ b/ios/MullvadVPN/Promise/PromiseCompletion.swift @@ -26,6 +26,16 @@ enum PromiseCompletion<Value> { } } + /// Returns `true` when the completion is `.cancelled`. + var isCancelled: Bool { + switch self { + case .cancelled: + return true + case .finished: + return false + } + } + /// Map the contained value, producing new `PromiseCompletion` type. func map<NewValue>(_ transform: (Value) throws -> NewValue) rethrows -> PromiseCompletion<NewValue> { switch self { |
