有关于 NotificationCenter.MainActorMessage 的内容吗?
Asked on 2025-06-24
1 search
在 WWDC 2025 的 "What’s new in Swift" 会议中,提到了关于 NotificationCenter.MainActorMessage
的内容。具体来说,通知名称和负载现在支持具体类型,这允许编译器检查对象是否支持您注册的通知类型。如果通知是在主 actor 上发布的,符合 MainActorMessage
的通知保证总是同步地在主线程上发布。有关详细信息,请参阅 What’s new in Swift (11:33)。

What’s new in Swift
Join us for an update on Swift. We’ll talk about workflow improvements that make you more productive, and new and modernized library APIs for fundamental programming tasks. We’ll show examples of Swift adoption throughout more layers of the software stack. Finally, we’ll explore new language features for both improving approachability of concurrency, and achieving peak performance when you need it.

Embracing Swift concurrency
Join us to learn the core Swift concurrency concepts. Concurrency helps you improve app responsiveness and performance, and Swift is designed to make asynchronous and concurrent code easier to write correctly. We’ll cover the steps you need to take an app through from single-threaded to concurrent. We’ll also help you determine how and when to make the best use of Swift concurrency features – whether it’s making your code more asynchronous, moving it to the background, or sharing data across concurrent tasks.

Migrate your app to Swift 6
Experience Swift 6 migration in action as we update an existing sample app. Learn how to migrate incrementally, module by module, and how the compiler helps you identify code that’s at risk of data races. Discover different techniques for ensuring clear isolation boundaries and eliminating concurrent access to shared mutable state.