Cancellable
public protocol Cancellable
Represents a cancellation handler over an asynchronous operation. Cancellation may be immediate or simply requested to happen sometime in the future.
A typical usage for Cancellable is to return it from the asynchronous completion-based API.
let cancellable = asynchronousFunction(completion: completion)
if shouldCancel {
cancellable.cancel()
}
Note
Cancellable implementation must support thread-safety and guarantee that
after calling cancel() the cancellation happens only once.
-
Cancels scheduled operation or does nothing if the operation is finished before the call.
Note
Subsequent calls shouldn’t do anything.Declaration
Swift
func cancel()
TomTom SDK for iOS (0.53.1)
Cancellable