Skip to content

Instantly share code, notes, and snippets.

View toanbuidjv's full-sized avatar

toanBV_vn toanbuidjv

View GitHub Profile
@toanbuidjv
toanbuidjv / NSObject+AnyCancellable.swift
Created May 26, 2021 10:31 — forked from tonyarnold/NSObject+AnyCancellable.swift
A nifty extension that I borrowed from DeclarativeHub's ReactiveKit: https://github.com/declarativehub/reactivekit/
import Combine
import ObjectiveC.runtime
extension NSObject {
private enum AssociatedKeys {
static var CancellablesKey = "CancellablesKey"
}
/// A set that can be used to dispose of Combine cancellables.
public var cancellables: Set<AnyCancellable> {