Skip to content

Commit

Permalink
Fix Notification Non-Sendable warning (#631)
Browse files Browse the repository at this point in the history
- The issue was the Notification is not sendable. We're not using any
data from the Notification, so make it a Sequence of something else.
- Found via
https://stackoverflow.com/questions/77070439/swift-silence-non-sendable-notification-cannot-cross-actor-boundary-warning
  • Loading branch information
bolsinga authored Sep 19, 2023
1 parent b648eff commit 352ebdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/Site/Music/UI/NotificationModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct NotificationModifier: ViewModifier {
.task {
Logger.notification.log("task: \(name.rawValue, privacy: .public)")
mainDeferredAction()
for await _ in NotificationCenter.default.notifications(named: name) {
for await _ in NotificationCenter.default.notifications(named: name).map({ $0.name }) {
Logger.notification.log("notified: \(name.rawValue, privacy: .public)")
mainDeferredAction()
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/Site/Music/VaultModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ extension VaultError: LocalizedError {
defer {
Logger.vaultModel.log("end day monitoring")
}
for await _ in NotificationCenter.default.notifications(named: .NSCalendarDayChanged) {
for await _ in NotificationCenter.default.notifications(named: .NSCalendarDayChanged).map({
$0.name
}) {
Logger.vaultModel.log("day changed")
updateTodayConcerts()
}
Expand Down

0 comments on commit 352ebdd

Please sign in to comment.