3 MISTAKES to avoid when using Async / Await in Swift 😌

  Переглядів 8,954

Vincent Pradeilles

Vincent Pradeilles

Рік тому

#iOS #swift #softwaredeveloper #iosdeveloper
Thank you for watching this video 🙌
➜ Website: www.swiftwithvincent.com
➜ Twitter: / v_pradeilles
➜ GitHub: github.com/vincent-pradeilles/
➜ LinkedIn: / vincentpradeilles

КОМЕНТАРІ: 14
@v_pradeilles
@v_pradeilles Рік тому
⚠ There's a a slight mistake at 04:10: while it's true that the `Task.detached` won't be canceled, it would have also been the same for a regular `Task`. ⚠
@mazedar_tv
@mazedar_tv 4 місяці тому
so is Task.detached beneficial only if developer wants that task to execute out of main actor?
@FloWritesCode
@FloWritesCode Рік тому
Tip #2 was really good, Vincent! I never thought about where to place the guard let self. Thanks for sharing!
@v_pradeilles
@v_pradeilles Рік тому
You're welcome! It's such a tricky pitfall 😩
@mazedar_tv
@mazedar_tv 21 день тому
main culprint is await notifiaction (async in async), so we needed this solution.
@edwardhasted3849
@edwardhasted3849 10 місяців тому
This is one of the most eloquent and succinct coding explanations I have found to date. Très cordialement
@alkincakiralar9932
@alkincakiralar9932 Рік тому
Yesterday, i learned retain cycle from your previous videos. Today I try the Tip #2 in new sample project and I realized that the ViewModel not delocating from memory if we use the listenNotifications method as the first example. I check the ViewModel class allocation in memorygraph with everysteps to learn what's going on in the memory. Thank's for this valuable post for us !
@yonaharel1122
@yonaharel1122 Рік тому
Thanks for the video! I have a question about point 2 of the video. Does creating the async stream has different effect on memory when created outside of the Task closure or inside?
@madman334
@madman334 22 дні тому
What if I need to reference self. before loop? like: for await value in self.manager.$items.values {...}
@Foxdie993
@Foxdie993 Рік тому
4:10 Are you sure that a Task (A simple Task, without detached) inside a Task will cancel in a cascade way?
@v_pradeilles
@v_pradeilles Рік тому
You’re right, it wasn’t the best example, I’ve pinned a comment with a warning
@victorriurean
@victorriurean Рік тому
nice
@LucasAbijmil
@LucasAbijmil Рік тому
Tip #1 is interesting, however in case the refresh token is expired, it would cause a double request to get a new one. How can we avoid this with?
@v_pradeilles
@v_pradeilles Рік тому
That's an interesting point! I guess it's a matter of whether you want to optimize for the normal case or for the edge case. If there's no real bad consequence to make two calls for nothing when the token has expired, I'd say it's better to stick with this simpler solution.
😨Новая Война в GTA 5 Online #shorts
00:40
King Dm
Переглядів 1,7 млн
3 MISTAKES to avoid when using closures in Swift 😌
5:02
Vincent Pradeilles
Переглядів 4,4 тис.
How to determine where code runs in Swift Concurrency
12:42
donny wals
Переглядів 1,6 тис.
How to use Task and .task in Swift | Swift Concurrency #4
34:24
Swiftful Thinking
Переглядів 21 тис.
Swift API Calls for Beginners (Networking) - Async Await & JSON
25:35
How to use MainActor with Observable Macro in SwiftUI | Swift Concurrency #19
12:31
Tips For Using Async/Await in JavaScript
16:26
James Q Quick
Переглядів 394 тис.
Собеседование junior iOS разработчик
1:12:43
Андрей Федоров
Переглядів 8 тис.
Илья Чикмарев - async/await в Swift
29:19
CocoaHeads
Переглядів 10 тис.
Async Await vs. Promises - JavaScript Tutorial for beginners
24:30
ColorCode
Переглядів 62 тис.
Игровой ноутбук за 100тр в МВИДЕО
0:58
KOLBIN REVIEW
Переглядів 524 тис.