mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-11-13 12:23:32 +01:00
allow ListPublisher and ObjectPublisher combine Publishers to cancel subscription from any thread
This commit is contained in:
1 parent
7938aa2447
commit
798d30bbd9
2 files changed
+24
-2
No files matched your search
@@ -135,8 +135,19 @@ extension ListPublisher {
|
||||
|
||||
func cancel() {
|
||||
|
||||
self.publisher.removeObserver(self)
|
||||
self.subscriber = nil
|
||||
|
||||
if Thread.isMainThread {
|
||||
|
||||
self.publisher.removeObserver(self)
|
||||
}
|
||||
else {
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
||||
self.publisher.removeObserver(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -135,8 +135,19 @@ extension ObjectPublisher {
|
||||
|
||||
func cancel() {
|
||||
|
||||
self.publisher.removeObserver(self)
|
||||
self.subscriber = nil
|
||||
|
||||
if Thread.isMainThread {
|
||||
|
||||
self.publisher.removeObserver(self)
|
||||
}
|
||||
else {
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
||||
self.publisher.removeObserver(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user