MENU

Fun & Interesting

WWDC21: Protect mutable state with Swift actors | Apple

Apple Developer 2,064 4 weeks ago
Video Not Working? Fix It Now

Data races occur when two separate threads concurrently access the same mutable state. They are trivial to construct, but are notoriously hard to debug. Discover how you can stop these data races in their tracks with Swift actors, which help synchronize access to data in your code. Discover how actors work and how to share values between them. Learn about how actor isolation affects protocol conformances. And finally, meet the main actor, a new way of ensuring that your code always runs on the main thread when needed. To get the most out of this session, we recommend first watching “Meet async/await in Swift.” Explore related documentation, sample code, and more: SE-0316: Global actors: https://github.com/apple/swift-evolution/blob/main/proposals/0316-global-actors.md SE-0313: Improved control over actor isolation: https://github.com/apple/swift-evolution/blob/main/proposals/0313-actor-isolation-control.md SE-0306: Actors: https://github.com/apple/swift-evolution/blob/main/proposals/0306-actors.md SE-0302: Sendable and @Sendable closures: https://github.com/apple/swift-evolution/blob/main/proposals/0302-concurrent-value-and-concurrent-closures.md The Swift Programming Language: Concurrency: https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html Visualize and optimize Swift concurrency: https://developer.apple.com/videos/play/wwdc2022/110350 Eliminate data races using Swift Concurrency: https://developer.apple.com/videos/play/wwdc2022/110351 Meet distributed actors in Swift: https://developer.apple.com/videos/play/wwdc2022/110356 Use Xcode for server-side development: https://developer.apple.com/videos/play/wwdc2022/110360 Discover concurrency in SwiftUI: https://developer.apple.com/videos/play/wwdc2021/10019 What's new in AppKit: https://developer.apple.com/videos/play/wwdc2021/10054 Meet async/await in Swift: https://developer.apple.com/videos/play/wwdc2021/10132 Explore structured concurrency in Swift: https://developer.apple.com/videos/play/wwdc2021/10134 What‘s new in Swift: https://developer.apple.com/videos/play/wwdc2021/10192 Swift concurrency: Update a sample app: https://developer.apple.com/videos/play/wwdc2021/10194 Swift concurrency: Behind the scenes: https://developer.apple.com/videos/play/wwdc2021/10254 More Apple Developer resources: Video sessions: https://apple.co/VideoSessions Documentation: https://apple.co/DeveloperDocs Forums: https://apple.co/DeveloperForums App: https://apple.co/DeveloperApp

Comment