SwiftUI MVVM with ObservableObject & Published (Swift 5, Xcode 12, 2020) - iOS Development

preview_player
Показать описание
In this video we will learn how to set up the Model View ViewModel (MVVM) pattern in SwiftUI. We will leverage ObservableObject and Published to automatically refresh views on view model changes. As always we will be working in Xcode 12 and Swift 5.

#swiftui #mvvm #iOSDeveloper

Join this channel to get access to perks, code, groups, and more:

** Get Skillshare free for 2 Months and learn iOS

** Manage all your investments from app earnings on Betterment!

** Grow your own Youtube tech channel with TubeBuddy:
Рекомендации по теме
Комментарии
Автор

I am all in on SwiftUI and I know I can trust you with my 12 minutes. So here I am. Nice tutorial video!

firstjamesryu
Автор

Cool video!! Now we need a video about Combine with SwiftUI and MVVM!:)

christostsangaris
Автор

one of few youtube channels I genuinely press like button before even watching video ;)

kmaximoff
Автор

Another great tutorial. I wanna ask why not you use StateObject instead of Observered Object. Could you please tell the differences of them?

omerkaraca
Автор

Hi!
It’s great that you started swiftui tutorials.

One thing I’d like to mention after watching the above video is you are using
@ObservedObject, here the functionality is limited so everything is alright. But you should use @StateObject, don’t get me wrong with @State, that’s different.

@StateObject declaration is basically telling the swiftui that this observableobject’s owner is that view having declared as @StateObject. If you are using @ObservedObject, basically it is like you are observing an object whose owner is someone else. In this current case the owner is the view itself so the view model object to be created with @StateObject

You might be aware of it already. Just for any viewers! I have some ideas about the content and community. Let’s discuss if you are open

tejeshwaramirthy
Автор

Fantastic description of mVvm. Makes perfect sense now. 🧠

bgriffin
Автор

Hi, why you dont connect the view with the vm using protocols?

MrBrunomalo
Автор

Verileri neden view ın içine koydunuz acaba? Model’de ya da viewmodel’de olması gerekmez mi?

necmettin_solmaz
Автор

for array of struct you can use just @State, like @State private var item = [ToDoListItem]()

gdtth
Автор

hi, when i click on the skillshare link, it says its only free for 2 weeks and not 2 months like you mentioned :/

coolbunny