Skip to content
Snippets Groups Projects
Commit b5ffe08c authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Merge branch 'fix/cancellable' into 'main'

Fix Cancellable

See merge request elixxir/elixxir-dapps-sdk-swift!10
parents 8665a1e6 5808d986
No related branches found
No related tags found
1 merge request!10Fix Cancellable
public final class Cancellable { public final class Cancellable {
public init(cancel: @escaping () -> Void) { public init(cancel: @escaping () -> Void) {
self.cancel = cancel self.onCancel = cancel
} }
deinit { deinit {
cancel() cancel()
} }
public let cancel: () -> Void public func cancel() {
guard isCancelled == false else { return }
isCancelled = true
onCancel()
}
private var isCancelled = false
private let onCancel: () -> Void
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment