What a fantastic video! I get new devs asking me all the time about SwiftUI and architecture and now I have a great video to refer them to! I loved the visual approach you took to explain it at the beginning and the code demo for the second half. 👏 New subscriber 👍
@BeyondOnesAndZeros4 жыл бұрын
Wow, I'm a huge fan of your content! Your visual approach to teaching definitely inspired me. I really appreciate your support 😊
@bigmtnstudio4 жыл бұрын
@@BeyondOnesAndZeros , ha ha, nice! It's like we came full circle. I shared this video on my Twitter feed too. Are you on there? If so, let me know your user name.
@BeyondOnesAndZeros4 жыл бұрын
@@bigmtnstudio exactly! haha I created one just now: "OnesBeyond" I saw your post, thank you for sharing! 😊👍
@danno56453 жыл бұрын
MVVM Is something that has confused me. I’ve done several tutorials before, but I think I actually understand it now after your video. This is the best example I have seen.
@BeyondOnesAndZeros3 жыл бұрын
Thanks Danno, great to hear that!
@bijendersinghshekhawat68422 жыл бұрын
yes bro me also
@tunatimetina Жыл бұрын
I've been so stuck on this, and now it clicks. Thank you!!
@BravoDesign883 жыл бұрын
This video does a great job explaining MVVM thank you. Please continue making more videos because they are really well done.
@necms3 жыл бұрын
Harika bir video. Mvvm ile ilgili çok video izledim ama en iyisi buydu. Sade ve anlaşılır bir biçimde anlatmışsınız. Thank you very much.
@joeprince75094 жыл бұрын
Very simple and clear explanation of MVVM, thank you! The examples you are providing with real world scenarios are great for people learning the new process.
@BeyondOnesAndZeros4 жыл бұрын
Thank you, Joe! That was indeed my intention with this videos, glad you agree 👍
@bkajebeukseb47263 жыл бұрын
Most concrete explanation I've seen. Clear and easy to understand. Well done. Teaching abstract ideas can be tough and this made it easy to comprehend. Thanks
@BeyondOnesAndZeros3 жыл бұрын
Thanks Bkaje, appreciate your feedback! :)
@JDo90003 жыл бұрын
This really helped! Waaaay clearer than any other videos I saw on KZbin
@BeyondOnesAndZeros3 жыл бұрын
Great to hear that, thanks Jeffrey!
@daraghmacgabhann10053 жыл бұрын
Best explanation and worked example of MVVM in SwiftUI by far! I was struggling to understand how to separate and access model and view model until I watched this video, I watched multiple other videos but they confused me even more! Thanks so much for breaking it down.
@BeyondOnesAndZeros3 жыл бұрын
Great to hear that! You’re welcome, Daragh!
@iliailiev9084 жыл бұрын
Exactly what I was looking for as a beginner lesson. Thanks bro!
@BeyondOnesAndZeros4 жыл бұрын
You’re welcome!
@jiabowang75603 жыл бұрын
This is the easiest video I have seen explaining mvvm
@samurai79384 жыл бұрын
Best video I have seen explaining MVVM. Thank you so much.
@BeyondOnesAndZeros4 жыл бұрын
Thanks, glad it was helpful! :)
@yokohibarashi13863 жыл бұрын
Completely understood at high level the importance and how to make use of MVVM in SwiftUI. Thank you very much.
@vorapons51723 жыл бұрын
Thank you for simple and easy explanation of MVVM
@BeyondOnesAndZeros3 жыл бұрын
You're welcome Voraapon, great to hear that!
@batuhankrbb3 жыл бұрын
It's one of the best lessons I've ever taken. Thanks!
@BeyondOnesAndZeros3 жыл бұрын
Thanks, Batuhan! Good to hear that :)
@tikhonnnnn4 жыл бұрын
That’s great! I didn't understand anything about swiftui logic for a long time and now I realised. Thanks!
@BeyondOnesAndZeros4 жыл бұрын
Awesome, glad it was helpful! :)
@beemercycle3 жыл бұрын
Great tutorial. Kept is simple and all in one file THANKS!
@xxfkee3 жыл бұрын
Thanks a lot for your clear and step-by-step explanation about MVVM. I finally ended up with clear understanding of this programming notion.
@BeyondOnesAndZeros3 жыл бұрын
Awesome! Great to hear that fkeebie :)
@andrejkling38863 жыл бұрын
Great explanation... Gratitude.
@TheMadG0073 жыл бұрын
Thank you very much, exactly what I wanted to know in an short example, with no unnecessary bla... bla ... ;o)
@9988khan4 жыл бұрын
impressive tutorial that cleared my confusion about mvvm, looking for more interesting tutorials from you 👍🏻
@BeyondOnesAndZeros4 жыл бұрын
Awesome, thank you! Glad it cleared up the confusion :)
@nataliiagetlin36113 жыл бұрын
Thank you! So clear and concise. High-quality content!
@brettandjacob47043 жыл бұрын
This is such a great tutorial that makes perfect sense! Great job!!
@dmitriykhan20113 жыл бұрын
Brilliant! Too pity that this channel does not have any new updates for a long time.
@GolfGuns3 жыл бұрын
Thanks for this. It was a very clear and specific example.
@BeyondOnesAndZeros3 жыл бұрын
You're welcome! :) glad it was helpful
@BruceCichowlas3 жыл бұрын
That's simple and clear! Sometimes this the complexity of protocols is added, particularly where one might want to substitute models or view models for purposes of alternate functionality or testing. However, I think it is good to leave that out in a tutorial of this level. Perhaps it is explained in an additional tutorial.
@mountrat3 жыл бұрын
In India, we often use the word "Guru" (in tamil) for a teacher who teaches in a best way. So... From now onwards, You are my Guru (குரு) (Teacher). :) ♥ 😍
@naytebeck31863 жыл бұрын
This was a really well put together video dude 👍 Thanks
@willasaskara3 жыл бұрын
very clear explanation and to the point tutorial, thanks!
@yotzincastrejon3 жыл бұрын
Great explanation!
@BeyondOnesAndZeros3 жыл бұрын
Thanks Yotzin!
@magicinternetmoney87152 жыл бұрын
Excellently explained like your other videos! Liked and subscribed, of course. One question for you: Any reason why you call the vm method "Intent" as opposed to method?
@johnpill12 жыл бұрын
This is an excellent explanation!
@megaBreezy4 жыл бұрын
Fantastic work!
@CredoAcademy4 жыл бұрын
Great tutorial indeed! 👍
@yazidali70713 жыл бұрын
Amazing video and amazing explanation, thank you very much. I'm a subscriber now 😁👍
@BeyondOnesAndZeros3 жыл бұрын
Thanks, Yazid!
@mika_chu3 жыл бұрын
Thank you! Great tutorial!!! What happens if the data is downloaded from the network? What is the path/ process in such case?
@johnr.54753 жыл бұрын
Really useful. Thanks.
@notorioustofu34822 жыл бұрын
Great video!
@rafeeq14103 жыл бұрын
@BeyondOnesAndZeros It may be a silly question. At the start of presentation you shows that Model represents Data&Logic, But while in coding the date math logic you did in ViewModel. I am bit confuse here, are we going to keep the logic in Model or ViewModel?
@DavidNitzscheBell3 жыл бұрын
At the beginning, he's talking about functions that pertain to a model, such as "chooseCard()" or "addHealth()" or whatever. But, the logic necessary to convert the Date variable into an Age integer, that goes in the ViewModel, because it's taking the data from the pure Model and massaging/preparing it for the View to use. That's the theory, at least.
@jorgepezzuol10884 жыл бұрын
Great tutorial. I have a question regarding the validation of the fields. That would go inside the view model?
@BeyondOnesAndZeros4 жыл бұрын
Thanks Jorge, great question! The validation "logic" itself can be considered a model but the actual validation (using the validator model) should happen in the viewModel. I recently worked on a project where I had to do some TextField validation (+ inline errors) and I ended up using Combine for it. I will try to create a tutorial for it! :)
@jorgepezzuol10884 жыл бұрын
Thanks, that would be great
@ryankanno25623 жыл бұрын
Awesome video! Thank you!
@ekkogaming54613 жыл бұрын
brooooo... BEST TUTORIAL. Really well done I subscribed!! why you stopped doing videos?
@BeyondOnesAndZeros3 жыл бұрын
Thanks, Ekko! I’m actually uploading a video right now, it should be available in the next few hours :D
@perrygupta3 жыл бұрын
Thanks for this
@BeyondOnesAndZeros3 жыл бұрын
You’re welcome! :)
@thecuriouspunjabi3 жыл бұрын
neat and clean explanation:-)
@andrei-un3yr3 жыл бұрын
what if your view displays a list of person model objects? Does your viewmodel translate each of the person objects into a separate model that's more easily accessible by the view?
@brilliantaksan3 жыл бұрын
I think the syntax for the bindings such as @StateObject and @ObservableObject, and if so what are the current ones? and how do they differ, ik i can just search it up on google but I might as well comment about this
@drmucahiderdogan3 жыл бұрын
Can you explain the memory issue of using @ObservedObject wrapper and initializing the VM in the properties a little more?
@marshallross2 жыл бұрын
So helpful!
@vell0cet5173 жыл бұрын
So the ViewModel is basically identical to a Controller, except the view drives the changes instead of the controller?
@LeeCasey3 жыл бұрын
Good video. One question. Say on a larger scale project as a game. You’d have models for player, monsters etc. Would they share one view model file/class or would there be playerViewModel & monsterViewModel? Thanks.
@BeyondOnesAndZeros3 жыл бұрын
A good rule of thumb is to say you have one viewModel per screen. That one viewModel may interact with different models (player, monsters etc.).
@LeeCasey3 жыл бұрын
@@BeyondOnesAndZeros thanks for replying. That makes sense now.
@605dave4 жыл бұрын
Very helpful, thank you.
@denniswhite67794 жыл бұрын
great presentation... why did you not use the getter/setter pattern when changing the name? do they not work with @StateObject and @Published?
@BeyondOnesAndZeros4 жыл бұрын
Hi Dennis, you're absolutely right. You could just use a getter and setter for the name. It would not be an issue with the property wrappers either. However, in more complex apps your intent will be often a function that does a bit more than just changing a property value.
@anuragwhocodes53833 жыл бұрын
Thanks dude, Subscribed!
@BeyondOnesAndZeros3 жыл бұрын
Awesome, thanks Anurag!
@wagmun3 жыл бұрын
Perfect!
@mika_chu3 жыл бұрын
Why Model is a Source of Truth while the Alice instance is actually stored in ViewModel?
@최승기-g8f3 жыл бұрын
Thank you!!!
@kimjiyoung86552 жыл бұрын
thank you, helps a lot. 😘
@Idlyravva4 жыл бұрын
Nice and clean
@johnybaby95743 жыл бұрын
cool
@sipanhazim41284 жыл бұрын
great
@BeyondOnesAndZeros4 жыл бұрын
Thanks! :)
@johncarson33334 жыл бұрын
Boss!!!
@erwin.agpasa5 ай бұрын
Power
@immanueldiaz57104 жыл бұрын
Also I think that if we follow MVVM more we can create 2 more classes like an Repository and a DataSource to get the data from an external API or a local data from a database and a third class that will be the WebService
@BeyondOnesAndZeros4 жыл бұрын
Hi Immanuel, good point however you could argue that this is a particular use case and not necessary to use MVVM. Nevertheless, I will soon create a video on Networking/Data accessing with MVVM as well :)
@immanueldiaz57104 жыл бұрын
@@BeyondOnesAndZeros great work man!!
@SwiftyPlace3 жыл бұрын
I think it would be better to place the model and the view model in a different file.
@BeyondOnesAndZeros3 жыл бұрын
Yes, you’re right! I usually mention that at the beginning of the video. It’s just easier to explain if you do not have to switch between files a lot ;)
@simonbachmann21204 жыл бұрын
Is it good practice to have one view model per model or is the view model more like a store that aggregates many models?
@BeyondOnesAndZeros4 жыл бұрын
Hi Simon, it is quite common that one viewModel configures multiple different models. However, if you have a more complex view hierarchy like charts and news in one screen, you would have one viewModel for the charts and one viewModel for the news. And each of them would work with multiple models that are relevant for that specific view.
@galaxiegalaxie50033 жыл бұрын
thanks for the video,here is the scenario,you go from home to setting screen,and suppose you changed something say language in setting screen and now you go back and it need to reflect on home,how you do that,could you make a video about it😁
@BeyondOnesAndZeros3 жыл бұрын
You’re welcome! Sure will add it to my list. Thanks for your suggestion.
@natureloverspakistan3 жыл бұрын
where i can add api requests
@DavidNitzscheBell3 жыл бұрын
Maybe the example is just too simplistic, but I don't understand why the struct Person can't have a computed variable, age, rather than creating a class ContentViewModel, etc. I'm reading and watching videos and looking at code, and I'm still not really understanding how/why MVVM is *vastly* different from MVC. Can't you put all the logic that would be in the ViewModel in the Controller? Why is that different? People talk about MVC stands for "Massive View Controller", but wouldn't any logic in there necessarily be in the ViewModel, too? How/why is a ViewModel going to have *less* code? Why, for instance, does the Person struct not have an Age computed variable? Is it really necessary to create a ContentViewModel for that? I'm looking for examples where the ViewModel provides something essential that is not possible with MVC or a computed variable. These examples are kind of useful, but not convincing.
@DavidNitzscheBell3 жыл бұрын
9:47 Suddenly there's a "Change Name" button in the Preview, but not in the code.... Oops.
@vvvorlds4 ай бұрын
How ist this not MVC???
@bunkie21003 жыл бұрын
Calling the model “the source of truth” is misleading. This is because the model is only a *definition* , not a source of data or state, The source of truth is the *instance* of the model declared and maintained by the view model.