diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-09-14 11:00:29 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-09-15 10:58:43 +0200 |
| commit | a8b3bcde29e9e2f334f2c4b80ee6b5b8d25167e2 (patch) | |
| tree | 989ccae70ed734c39e2c312a01d368ced57e55a3 /ios | |
| parent | e47f0a3a8c657fe0d26d3ace7824c42c95a48feb (diff) | |
| download | mullvadvpn-a8b3bcde29e9e2f334f2c4b80ee6b5b8d25167e2.tar.xz mullvadvpn-a8b3bcde29e9e2f334f2c4b80ee6b5b8d25167e2.zip | |
PromiseCompletion: add isCancelled helper
Diffstat (limited to 'ios')
| -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 { |
