diff options
| -rw-r--r-- | ios/MullvadVPN/Operations/OperationCompletion.swift | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ios/MullvadVPN/Operations/OperationCompletion.swift b/ios/MullvadVPN/Operations/OperationCompletion.swift index b8cf56a574..f75d17438d 100644 --- a/ios/MullvadVPN/Operations/OperationCompletion.swift +++ b/ios/MullvadVPN/Operations/OperationCompletion.swift @@ -57,6 +57,14 @@ enum OperationCompletion<Success, Failure: Error> { } } + init(error: Failure?) where Success == Void { + if let error = error { + self = .failure(error) + } else { + self = .success(()) + } + } + func map<NewSuccess>(_ block: (Success) -> NewSuccess) -> OperationCompletion<NewSuccess, Failure> { switch self { case .success(let value): |
