How does MainActor send your data to the main thread? 🧙🏼♂️
Swift and Tips
0:00 / 0:00
How does MainActor send your data to the main thread? 🧙🏼♂️
7 912 просмотров · 5 лет назад
Swift and Tips
13 тыс. подписчиков
7 912 просмотров · 5 лет назад
Hello guys, Welcome to another video!
In this video, we will learn how to use @MainActor to protect your mutable UI state and always send it to the main thread.
Content:
0:00 - Intro
0:19 - Why UI data must be sent to the main thread?
2:27 - Explaining demo
4:40 - Implementing MainActor
6:41 - Suspension points for actors
8:34 - More about concurrency
------
Source code showed in the video: https://github.com/pitt500/ActorsDemo...
------
Resources:
Global actors: https://github.com/apple/swift-evolut...
Actors (WWDC21): https://developer.apple.com/videos/pl...
Apple: https://developer.apple.com/documenta...
swift.org: https://docs.swift.org/swift-book/Lan...
------
Other videos in the channel:
Async/await: • Async/Await in Swift | Comparison vs Closu...
Actors: • How do Actors work in Swift?
Async Let: • How to download images in parallel with Sw...
-----
Don't forget to subscribe to the channel, like it, and follow me on social media:
Twitter:
/ swiftandtips
/ pitt500
Finally, ask me for a video you would like to see next 😄!
Credits:
Music by Wataboi from https://pixabay.com/
Video edited with LumaFusion