Last active
June 17, 2024 16:47
-
-
Save siracusa/137e3fae8a384ac4bda8c56524826d6b to your computer and use it in GitHub Desktop.
Swift Concurrency Candidate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSWorkspace.shared.notificationCenter.addObserver( | |
forName: NSWorkspace.didLaunchApplicationNotification, | |
object: nil, queue: nil, using: { [weak self] notification in | |
self?.doStuff() | |
}) |
Oh, right. That's a good point. Maybe I should leave it @MainActor
after all.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this is correct! But, I also do want to point out that this version makes it possible to pass data unsafely across threads by way of the
Notification
object. I don't think that's likely though.