diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-09-14 13:59:01 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-09-15 10:54:31 +0200 |
| commit | 76dd2c99bf92d608022efbf05ffcbfebda43e0c1 (patch) | |
| tree | 8cccb074a033089ac531e425f4a825df62b616c3 /ios/MullvadVPN/Operations/OutputOperation.swift | |
| parent | e553d10b869c46e7ab922b86c32f4bd016e4fdac (diff) | |
| download | mullvadvpn-76dd2c99bf92d608022efbf05ffcbfebda43e0c1.tar.xz mullvadvpn-76dd2c99bf92d608022efbf05ffcbfebda43e0c1.zip | |
Operations: simplify AsyncOperation, remove advanced features
Diffstat (limited to 'ios/MullvadVPN/Operations/OutputOperation.swift')
| -rw-r--r-- | ios/MullvadVPN/Operations/OutputOperation.swift | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/ios/MullvadVPN/Operations/OutputOperation.swift b/ios/MullvadVPN/Operations/OutputOperation.swift deleted file mode 100644 index 064d54a2e9..0000000000 --- a/ios/MullvadVPN/Operations/OutputOperation.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// OutputOperation.swift -// MullvadVPN -// -// Created by pronebird on 06/07/2020. -// Copyright © 2020 Mullvad VPN AB. All rights reserved. -// - -import Foundation - -protocol OutputOperation: OperationProtocol { - associatedtype Output - - var output: Output? { get set } - - func finish(with output: Output) -} - -extension OutputOperation { - func finish(with output: Output) { - self.output = output - self.finish() - } -} - -private var kOutputOperationAssociatedValue = 0 -extension OutputOperation where Self: OperationSubclassing { - var output: Output? { - get { - return synchronized { - return AssociatedValue.get(object: self, key: &kOutputOperationAssociatedValue) - } - } - set { - synchronized { - AssociatedValue.set(object: self, key: &kOutputOperationAssociatedValue, value: newValue) - } - } - } -} - -extension OperationProtocol where Self: OutputOperation { - func addDidFinishBlockObserver(queue: DispatchQueue? = nil, _ block: @escaping (Self, Output) -> Void) { - addDidFinishBlockObserver(queue: queue) { (operation) in - if let output = operation.output { - block(operation, output) - } - } - } -} |
