The Complete Guide Using SwiftUI MVVM Async Await & SwiftUI Error Handling: SwiftUI Tutorial

preview_player
Показать описание
The Complete Guide Using SwiftUI MVVM Async Await & SwiftUI Error Handling: SwiftUI Tutorial

**Warning Fix**

i.e to create an instance of it in the initialiser do the following below

@StateObject var vm: MyViewModel

init() {
self._vm = StateObject(wrappedValue: MyViewModel(service: MyService()))
}

In this complete guide Using SwiftUI MVVM Async Await Example, we will look at the new Swift Concurrency feature Async/Await and SwiftUI Error Handling.

We’ll look at the benefits and how we can use it to improve our asynchronous networking code, we’ll look at the things to look out for when using the new Swift concurrency code and also how we can handle errors. Well, let’s jump into this SwiftUI tutorial to see my swiftui async await project structure.

Timestamps

00:00 Introduction
00:43 Setting up our model
02:46 Setting up our Character Service
04:47 Breaking down the benefits of using Swift Concurrency’s Async/Await in Swift
06:50 Using Swift Concurrency’s Async/Await in our Networking code in Swift
13:48 Setting up our View Model
15:34 Using Swift Concurrency’s Async/Await in our view model
18:28 Breaking down & discussing @MainActor
19:19 Using our View Model in our SwiftUI view
19:43 Breaking down & discussing tasks to fetch our characters
21:11 Using our View Model State to display views
23:13 Error handling in our View Model
26:23 Testing out our work
28:07 Wrap up

Rick & Morty API

My SwiftUI Async/Await MVVM Project Structure & Approach (SwiftUI 3.0, async/await Swift, Xcode 13)

SwiftUI Data Flow (SwiftUI Tutorial, SwiftUI Beginner, Swift UI Data Flow)

Mastering Stacks in SwiftUI (VStack, HStack, LazyStacks, SwiftUI Tutorial)

Firebase SwiftUI Login, Registration, Password Reset & Session Management with Combine

Setup SwiftUI App with Firebase SPM (Swift Package Manager, SwiftUI Tutorial, Firebase Crashlytics)

Getting Started with Combine (Practical Combine Framework Examples in UIKit & SwiftUI)

SwiftUI Form Validation using Combine (SwiftUI Tutorial, Regular Expressions, Combine Framework)

Build a news app in SwiftUI tutorial series

Build Onboarding Screens in SwiftUI (TabView, PageTabViewStyle, SwiftUI Tutorial, @AppStorage)

SwiftUI Redacted Tutorial - Loading Skeleton View - (SwiftUI Tutorial, Xcode 12, SwiftUI 2.0)

Build Clubhouse in SwiftUI 2.0 and Dark Mode (SwiftUI Tutorial, SwiftUI 2.0, Clubhouse App Clone)

Dark Mode in SwiftUI using @Binding & @AppStorage (SwiftUI Tutorial, @Binding, @AppStorage)

#tundsdev #swiftuitutorial #xcode13 #swiftuimvvmexample #swiftuiasyncawait #swiftuibasics
Рекомендации по теме
Комментарии
Автор

I can honestly say this is the first video on async/await that really clicked with me - so good. Thanks so much, looking forward to more videos!

SBSanook
Автор

This video is actually super great example of Async/Await!!! 🔥🚀Also when u show us how to handle these edge cases with custom errors... It is PARADISE of learning hahaha Thanks a lot mate

vojtechkalivoda
Автор

Great great video about async await. It's the most complete video that also includes response and error handling. Terrific.

gastongasquet
Автор

I think this might be the best practices for mvvm async/await in swiftui. I must subscribed!

felixmatusinio
Автор

Best ever swift networking tutorial I've seen on YouTube. Thanks man.

Feels like using Flutter and Riverpod Mvvm pattern 💙

Collins
Автор

Another extremely useful and planned out video. Love it.

StewartLynch
Автор

good stuff my bro people are charging money for this in deprh content we appreciate you my bro

iLoveAppl
Автор

I enjoyed this video. Thank you for putting it together. It's nice to see async/await finally make it to Swift to things can be simplified

DougRobison
Автор

Thanks a bunch. You do a great job clearly explaining the material.

douglasalexander
Автор

Thank you for this! Very well explained! You have got yourself a new subscriber!

JoeVargas
Автор

Thank you for your continued stellar SwiftUI content. Great scope covered and explanations.

jimkurring
Автор

Thanks. I’m digging into swift right now and I’m kind of surprised that it is only just now getting async await support. I guess my timing is good.

jontaylor
Автор

I love you video mvvm with asyn ❤, you are wonderful

KhanhQuang-ffve
Автор

Informative, good code structure, and nicely explained. Thank you very much.

paulallies
Автор

Thank you so much for putting effort into making all these videos on iOS development, Tunde 🙇‍
I'm relatively new to Swift and I've already learnt a lot! I really like your focus on practical examples, explaining your decisions as you go, solid naming conventions and unit testing.

Just a small suggestion - you might want to consider recording the screen in a lower resolution to make the videos a bit more smaller screen-friendly. I know a phone is perhaps not the best tool for watching YouTube and it's great you've increased the font size in Xcode but I think scaling the resolution a bit would make your content that tiny bit more accessible.

ChrisKobrzak
Автор

So cool, so much fun. great techniques and explanations. I would love to see how you would implement infinite scrolling in the list, the API returns only first 20 results (671 characters, so not truly infinite). Maybe throw in the searchable modifier and build out the UI a bit. Just thoughts. I'll figure it out, Tanks tunds! Great choice of API. Hyped!

timsonner
Автор

Nicely explained, thanks. Can you do an in depth tutorial with Mapkit/CoreLocation? SwiftUI 3 seems to have some features to implement it easier.

erdemsenol
Автор

Which one is more better approach Asyn/Await or Combine ?
please who see this comment must reply your reply is really helpful for me.

syedmeer
Автор

Create some more videos on unit tests and dependency injection

zeeshansuleman
Автор

On larger projects do you typically use a DI library or container or do you still manually create services and pass them through constructors?

jontaylor