mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-09-10 20:01:57 +02:00
WIP
This commit is contained in:
@@ -52,6 +52,27 @@ extension Internals {
|
||||
using: closure
|
||||
)
|
||||
}
|
||||
|
||||
init(
|
||||
notificationName: Notification.Name,
|
||||
object: Any?,
|
||||
closure: @escaping @MainActor (_ note: Notification) -> Void
|
||||
) {
|
||||
|
||||
self.observer = NotificationCenter.default.addObserver(
|
||||
forName: notificationName,
|
||||
object: object,
|
||||
queue: .main,
|
||||
using: { note in
|
||||
|
||||
nonisolated(unsafe) let note = note
|
||||
MainActor.assumeIsolated {
|
||||
|
||||
closure(note)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
deinit {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user