Swift Concurrency Lesson 5 - Parallel Concurrency with Async Let

preview_player
Показать описание
This is the 5th of 6 videos in the Swift Concurrency series. In this video we are going to extend that even further by introducing you to parallel asynchronous concurrency using Async let.
We will create a new model to contain a user and all of that users posts in an array and use that model after fetching all users and all posts up front in two asynchronous calls running in parallel, when the UsersListView loads thus potentially, reducing the number of network requests.

Links and Resources

Swift Concurrency Series Playlist:

Starter Code Completed Source code for Part 4:

Part 5 Completed Code:

Timestamps
0:00 Introduction
1:21 Creating a new UserAndPosts Model
3:06 Perform 2 network requests one after another
8:56 Create Mock Data for the new model
11:08 Use Async Let for parallel, concurrent network requests

🚨 SPECIAL CWC+ OFFER FOR YOUTUBE:

MY FREE ONLINE COURSE:

CWC+ PROGRAM:

WEEKLY UPDATES VIA EMAIL:

CONNECT:

ABOUT CODEWITHCHRIS:

DID THESE LESSONS HELP YOU?

ROADMAP:
Рекомендации по теме
Комментарии
Автор

A thank you is not enough for your services

SantosEnoque
Автор

Thanks for the crash course! One question - shouldn't we remove the "try await"s in the original "let"s around 12:30 when we use "async let"? As in execution does not need to suspend at those two lines

helloworld
Автор

Great stuff Stewart. Getting the hang of this I think.

chrispyk
Автор

Hey Chris, I have been watching your videos for a few days now. Trust me you are the best!! I have a recommendation for a video. I've been waiting for an easy video explaining how to do it. But it never came. My recommendation is a video explaining how to code an application for Apple CarPlay. Also, I'm just making sure that Chris is ok because I haven't seen him posting videos lately or responding to comments himself. No worry's if you can't answer the last question.

ChaimHonikman
Автор

To show the number of count of Posts, we can also utilise the .badge modifier!
Which is introduced in SwiftUI 3 & from iOS 15 onwards 🙂
Just giving a thought to reduce the tree hierarchy of declarative UI. 😀
Would you try to showcase the same in your next tutorial? Only if that works for you!

At last, Nice video and Calm explanation as always!

rasheshbosamiya
Автор

This is a great series. Stewart is fantastic at explaining the details of features without over complicating things. One question: Every time the list of users is displayed the app makes a call out to the api, which is great if that information is constantly changing outside of the app, but if we only wanted that data to be loaded once per app session what would be a good approach to limit the calls out the the api? Would making it an @EnvironmentObject instead of a @StateObject make sense? Does anyone have any thoughts?

philmoore
Автор

I have installed xcode in Windows VMware macOS.

xm