Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Mar 19, 2024
1 parent 02554c5 commit 4ca9c46
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
12 changes: 0 additions & 12 deletions Sources/Verge/Library/StoreSubscription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ public final class StoreSubscription: Hashable, Cancellable, @unchecked Sendable
associatedStore = nil
}

func associate(store: some StoreType) -> StoreSubscription {
ensureAlive()
associatedStore = store
return self
}

func associate(object: AnyObject) -> StoreSubscription {
ensureAlive()
associatedReferences.append(object)
return self
}

/**
Make this subscription alive while the source is active.
the source means a root data store which is Store.
Expand Down
36 changes: 18 additions & 18 deletions Sources/Verge/Library/VergeAnyCancellable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,6 @@ import Combine
/// A typealias to `Set<AnyCancellable>`.
public typealias VergeAnyCancellables = Set<AnyCancellable>

final class Reference: Equatable, Hashable {

static func == (lhs: Reference, rhs: Reference) -> Bool {
lhs === rhs
}

func hash(into hasher: inout Hasher) {
ObjectIdentifier(value).hash(into: &hasher)
}

let value: AnyObject

init(value: AnyObject) {
self.value = value
}

}

/// A type-erasing cancellable object that executes a provided closure when canceled.
/// An AnyCancellable instance automatically calls cancel() when deinitialized.
/// To cancel depending owner, can be written following
Expand Down Expand Up @@ -185,3 +167,21 @@ public final class VergeAnyCancellable: Hashable, Cancellable, @unchecked Sendab
///
@available(*, deprecated, renamed: "Cancellable", message: "Integrated with Combine")
public typealias CancellableType = Cancellable

private final class Reference: Equatable, Hashable {

static func == (lhs: Reference, rhs: Reference) -> Bool {
lhs === rhs
}

func hash(into hasher: inout Hasher) {
ObjectIdentifier(value).hash(into: &hasher)
}

let value: AnyObject

init(value: AnyObject) {
self.value = value
}

}

0 comments on commit 4ca9c46

Please sign in to comment.