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

Merge branch 'fix/cancellable' into feature/example-network-health-monitor

parents 47d1a2b3 5808d986
No related branches found
No related tags found
1 merge request!11[Example App] Monitor network health
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