-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Sendable
conformance and support for Concurrency
#74
Conversation
… become MainActor
.../UINotifications-Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Show resolved
Hide resolved
Code Coverage Report
SwiftLint found issues
Generated by 🚫 Danger Swift against c7a652d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 nice work!
Congratulations! 🎉 This was released as part of Release 2.0.0 🚀 Generated by GitBuddy |
This PR is a breaking change and introduces support for Swift Concurrency. There are a few important design decisions I made to keep the code changes at implementation level to a minimum and reduce complexity at call side:
UINotificationCenter
is unchecked Sendable since all its mutation happens either on the Main Actor or is unlikely going to be in sequence with write operations. I've tried making it a@MainActor
, but resulted in difficulties throughout the implementation level. For example, callingUINotificationCenter.current
from a non-mainactorinit
would result in build failures.@MainActor
attribute. Mostly since we're dealing with user interface notificationsAltogether, the result is a thread-safe solution done by using both Swift Concurrency and lock queues. Check out internal comments for additional context.