Swift: Actors Introduction (2023, Xcode 13) - iOS

  Рет қаралды 38,681

iOS Academy

iOS Academy

2 жыл бұрын

In this video we will do a brief introduction of Actors in Swift. Recently introduced alongside async await patterns, actors help simplify concurrency in your iOS projects. They help to synchronize calls, enforce threads/queues, and a whole lot more. We will work in Xcode 13 with the latest version of Swift.
💻 Source Code: / iosacademy
🎥 Subscribe for more: kzfaq.info?su...
😎 Like my teaching style? Check out some of my most popular courses! courses.iosacademy.io
👉🏼 Connect (personal LinkedIn) / afraz-siddiqui
🚀 Follow on LinkedIn / ios-academy
** Popular Series
Building Instagram: courses.iosacademy.io/p/build...
Building TikTok: / @iosacademy
SwiftUI for Beginners: ios-academy.teachable.com/p/s...
** Get Skillshare free for 2 Months and learn iOS
www.skillshare.com/r/user/afraz
** Manage all your investments from app earnings on Betterment!
bit.ly/3eBwlI9
** Grow your own KZfaq tech channel with TubeBuddy:
www.tubebuddy.com/iosacademy
#swift #actors #asyncAwait

Пікірлер: 41
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Enjoy my teaching style? Check out iOS Academy+ iosacademy.io/plus
@CombuskenKid
@CombuskenKid 2 жыл бұрын
I'm not using async await for our app yet because of backwards compatibility of previous ios versions, however I have used it in personal projects and I love it. Actors seem really powerful so thanks for the video, seeing a new concept pop up on my recommended is a good way to learn when you don't have time to watch all the wwdc videos.
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Thanks!
@BABEENGINEER
@BABEENGINEER Жыл бұрын
"we're gonna call this 'Actor' because we're super creative on this channel" got me 😂😂
@DoubleCheapBurger
@DoubleCheapBurger 2 жыл бұрын
Love the content and your channel’s consistency, bro! 👍🏼
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Thank you!
@timotiusleonardo1966
@timotiusleonardo1966 2 жыл бұрын
Please add more detailed tutorial for this bro! Its amazing… i want to learn more from you how to implement actors practically in real project
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Coming soon
@njunior1983
@njunior1983 2 жыл бұрын
Thanks, man.. Keep up the good work! 🤟🏻
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Thank you! Appreciate it
@BABEENGINEER
@BABEENGINEER Жыл бұрын
Do we have to use async/await with actors? or can we use actors without it?
@0xBiscuit
@0xBiscuit 2 жыл бұрын
So this basically replaces the semaphores? Also your teaching is very great.
@dream_emulator
@dream_emulator Жыл бұрын
Question... Do you know why don't you need `await`s if you add `@MainActor in` ? Thanks, great vids 🙏
@sshnee
@sshnee 2 жыл бұрын
Hey, thanks for the video! Just a little note (hopefully I'm not mistaken): the queue that you've created is serial by default so there's no need to use sync
@visskiss
@visskiss Жыл бұрын
Yep. His code would have worked just fine because dispatch queues are serial. Actors just replace that dispatch queue boilerplate.
@dev_jeongdaeri
@dev_jeongdaeri 2 жыл бұрын
Super awesome! 😎
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Thank you
@ChristopherCricketWallace
@ChristopherCricketWallace 2 жыл бұрын
almost 46K subs! You're going to the moon, baby!
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Haha thanks!
@andreygluhih2397
@andreygluhih2397 2 жыл бұрын
race condition in serial queue? im not sure there was any problem, if you store a, b, c and then want to get c, your task will be executed in order(because that is a Serial Queue, first in first out), and you will get a right c value.
@trappedIRL
@trappedIRL 2 жыл бұрын
He was saying a race condition could happen when using async operations.
@andreygluhih2397
@andreygluhih2397 2 жыл бұрын
@@trappedIRL no it can't be in serial queue, race condition can only be in concurrent one
@andreygluhih2397
@andreygluhih2397 2 жыл бұрын
or it can be, but if the one object is used on more than one serial queue, but my point is - the example is kinda bad, it works fine without refactoring
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Correct. I was saying a race in async
@alfredlapkovskiy6634
@alfredlapkovskiy6634 2 жыл бұрын
@@iOSAcademy If you used async in save method and sync in get, there is no chance of race condition because sync call makes the current thread wait for the sync result and sync itself is waiting for all previously submitted tasks to complete before returning the result. And it’s a serial queue, so each async task will be executed in order you submitted them.
@momentoelectrico4323
@momentoelectrico4323 5 ай бұрын
Playground execution failed: error: execution stopped with unexpected state. error: Execution was interrupted. The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
@seamieshame
@seamieshame 2 жыл бұрын
Is there a reason you did not define User as a struct to get the initialiser for free, remove mutation etc? Is there some limitation here around actor or async await?
@fermatslasttheorem6298
@fermatslasttheorem6298 2 жыл бұрын
Many models are created as classes many times because you might have to change the values and want them to be retained by the same object. Remember that structs are value types and classes are reference types. In this small example, it didn't really matter if it was a class or struct.
@AmitBiswastunebox
@AmitBiswastunebox Жыл бұрын
Hi Afraz I think we need more video regarding Async, Actor.
@iOSAcademy
@iOSAcademy Жыл бұрын
Coming soon
@luki8502
@luki8502 2 жыл бұрын
Hey! Could you please do a video on how to add swipe actions to a collection view? I searched everywhere but I can’t find it 😭
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Added to my list
@nasir519
@nasir519 2 жыл бұрын
I just like to know how the AsyncStream can replace Combine' Pub/sub pattern, If you can make a video on it, that would be really helpful. Also please include ads in your video, just to support you I ll watch entire ads on your videos. Thanks
@Telecontari
@Telecontari 2 жыл бұрын
nice👏
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Thanks
@HiChunTaChen
@HiChunTaChen 2 жыл бұрын
Actor is more complex than using serial queue and async.
@khaledannajar5110
@khaledannajar5110 2 жыл бұрын
I get this warning:No 'async' operations occur within 'await' expression. Xcode 13.2
@JackeryPumpkin
@JackeryPumpkin 2 жыл бұрын
Tough acting tenactor
@JeanetteMueller
@JeanetteMueller 2 жыл бұрын
id: String ?!? WTF
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Could be a number too
@fermatslasttheorem6298
@fermatslasttheorem6298 2 жыл бұрын
I mean if you want to be realistic, you could go for "var id: String = UUID()"
My little bro is funny😁  @artur-boy
00:18
Andrey Grechka
Рет қаралды 13 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 56 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 44 МЛН
Intro to Sendable in Swift 5 (2022)
11:23
iOS Academy
Рет қаралды 12 М.
Debugging in Xcode 13: Tips & Tricks (2022) - iOS
14:02
iOS Academy
Рет қаралды 42 М.
Global Actors in Swift (2022) - iOS
12:26
iOS Academy
Рет қаралды 6 М.
Илья Чикмарев - async/await в Swift
29:19
CocoaHeads
Рет қаралды 10 М.
Swift-уроки: Actor
20:58
Сергей Горбачёв / cmd+B, cmd+R
Рет қаралды 1,5 М.
Your Brain 🧠 on Swift Concurrency - iOS Conf SG 2023
30:38
iOS Conf SG
Рет қаралды 8 М.
Swift API Calls for Beginners (Networking) - Async Await & JSON
25:35
3 MISTAKES to avoid when using Async / Await in Swift 😌
4:41
Vincent Pradeilles
Рет қаралды 10 М.
My little bro is funny😁  @artur-boy
00:18
Andrey Grechka
Рет қаралды 13 МЛН