If you’re using Swift the DispatchWorkItem class allows works units to be cancelled individually.
Work items allow you to configure properties of individual units of work directly. They also allow you to address individual work units for the purposes of waiting for their completion, getting notified about their completion, and/or canceling them. ( available for use in iOS 8.0+
macOS 10.10+ ).
DispatchWorkItem encapsulates work that can be performed. A work item
can be dispatched onto a DispatchQueue and within a DispatchGroup. A
DispatchWorkItem can also be set as a DispatchSource event,
registration, or cancel handler.
↳ https://developer.apple.com/reference/dispatch/dispatchworkitem