Bro. After watching this, I feel like I owe you money now. Definitely helped a lot. 🔥
@pqsk3 жыл бұрын
nice tutorial. straight to the point, no beating around the bush, no 5 minutes of talking randomness and then 20 minutes into the video reiterating that just to make the video a certain length 😂 again thanks for the quick explanation!
@talldane2538 Жыл бұрын
Kilo's recent postings exude the kind of confidence and completeness I appreciate when trying to learn/use SwiftUI in the real world. His comments especially give you the kind of insight you need when considering completeness (lifecycle). Production is topnotch as well, no more fumbling over errors or mistyping.
@ghazitozri49894 жыл бұрын
this kind of realistic senarios are the best, please feed us more Loco ! good luck
@ssturge9633 жыл бұрын
This video was absolutely perfect. Dependency injection with default values, protocols & mocking is how I work right now with UIKit, and your video was perfect for teaching me how to work the same way with SwiftUI. Loved it.
@huntermeyer49724 жыл бұрын
This is great. I'd love to see various example of MVVM with real-world examples of a backend, whether through networking or some sort of persistence manager (I'm thinking Codable, Core Data, etc.) I'd also love a more clear explanation of how to Combine with MVVM in a more powerful way than what was done in this video. Thanks!
@christianschuster41714 жыл бұрын
This is the thing we need “real world scenario”. Implementing MVVM and it works, adding a network delay and the preview stops working. Thanks for putting this out! Data flow in this design pattern is a point of interest. A common scenario should be a settings view that changes a app-wide setting which another view has to notice.
@lamehunter3 жыл бұрын
best video i watched this year lad good job
@FredLacis4 жыл бұрын
Great video! Whenever a project starts to get bigger a problem that I have is on how to organize the architecture and the folder structure, it would be nice to see how you do it, maybe in a real project or something like that!
@Kilo_Loco4 жыл бұрын
Working on a real project and the course will be available soon 😉
@shivaskanthan61444 жыл бұрын
@@Kilo_Loco this sounds promising. Looking forward to it :)
@franciscojavierpriorramos11104 жыл бұрын
I am so happy to see another video of you again
@Skolzerx4 жыл бұрын
Nice, I like the idea of using an extension to wrap the view model. Never seen that before but makes alot of sense to me.
@stephanjanuar29234 жыл бұрын
Best Explanation of MVVM I have seen.
@larryogrodnek67333 жыл бұрын
Thanks! You’re a great teacher! I really appreciate how you specifically called out how to get things working in previews and how to make it testable,
@Kilo_Loco3 жыл бұрын
Glad it was helpful!
@ivanyoed2 жыл бұрын
Great Video Kilo.
@hotskyakash2 жыл бұрын
Excellent explanation Kilo 👏
@thugcow4 жыл бұрын
Good video! Clean and to the point. Def helps with transitioning from thinking of UIKit MVVM to SwiftUI MVVM.
@abhishekbedi14322 жыл бұрын
Wonderful! Just what I needed!
@CraigSchubert2 жыл бұрын
Great video - thanks! I love how you gave the different levels of the concept. More videos like this please!! :-)
@marshallross2 жыл бұрын
Op! Did I just find my new favorite KZbin?
@danlkramer3 жыл бұрын
Very clear explanation and example. Thank you!
@workflowinmind3 жыл бұрын
This is a great approach
@alcprado3 жыл бұрын
Excellent content, straight and clean. Ty
@podomunro3 жыл бұрын
Great video. I'd like to see an example where we need to pass the 'Users' from view to view, where each of those views have their own ViewModel. I don't want to be 'fetching' my data each time I initialise a new ViewModel. Thanks :)
@jeraldo45712 жыл бұрын
Thanks for this tutorial. It's easier to understand and the pace is spot on. I've been using state based MVVM in UIKit and was wondering how I can use it in SwiftUI.
@kyunghwankim12692 жыл бұрын
Amazing! Thank you :)
@_WhatsInAName_3 жыл бұрын
I would really really appreciate a session exactly like this but with DataStore as the main source of data. You mentioned using "data managers" instead of a DataService; is this what you meant? DataStore is a singleton though isn't it? It is sort of available via injection, not via @Environment but via 'import Amplify'. Perhaps I need to learn more about Combine but how would you extract the DataStore.hub.publisher call into a separate DataService class? Can you 'mock' DataStore.hub or should GraphQL calls to it be encapsulated in a DataService for testing the ViewModel?
@salihcnkhy4 жыл бұрын
It's super, thanks a lot! I would like to see MVVM architecture that build with Combine and SwiftUI frameworks. That would be so cool
@denisblack98973 жыл бұрын
What’s cool is UIKit and MVC) do the job, stop fooling around
@aaronlabeau10073 жыл бұрын
Great video!
@jyman4 жыл бұрын
Thanks for your video, it is really helpful to me. Thanks!
@jacques-dev3 жыл бұрын
Hey Kilo! Thanks for the video. Any tips on project file/folder structure?
@abdouett36764 жыл бұрын
Thank you Kilo Loco!
@Kilo_Loco4 жыл бұрын
It’s my pleasure 😁
@hirokiishida3752 жыл бұрын
Thanks for the content. I saw your other protocol videos but I'm not quite understanding the benefit of introducing protocol here. Could you kindly elaborate on the following?? "It also gives us the flexibility to start testing with like a MockDataService or whatever you want to do there and all this functionality will still work" (11:19)
@hirokiishida3752 жыл бұрын
Sorry, I understood it by watching this: kzbin.info/www/bejne/oXnXdqd3hZl3hKM
@luism38894 жыл бұрын
Great explanation, would be great to see a tutorial of MVVM + CoreData
@alanramirez10313 жыл бұрын
Test names need to start with test otherwise Xcode will not detect them, just writing because I know I was having trouble because of that. Great tutorial, thanks.
@DrunkZergling4 жыл бұрын
Great demo. I found it easy to follow and understand. As a tutorial for people learning MVVM, would it be better to have a more concrete discussion on what problem we're trying to solve? Maybe have an example of a View that has too much business logic in it, and a description of the problems that creates. Then the demo is moving code out of the View into the ViewModel. For me, this sort of conversation about what problem we want to solve is very helpful, especially with examples.
@Kilo_Loco4 жыл бұрын
Thanks for the input. That gives me a lot to think about. Will definitely keep that in mind for future videos
@hallux54113 жыл бұрын
@@Kilo_Loco I know I'm late to the party here but I second what he's saying. I found this very helpful and informative but a better structure at the beginning outlining what our goal was with a finished product, a bit more logic going on would make this even better. Thank you for the content!
@lukassbeataddicts3 жыл бұрын
Kilo Loco never disappoints. At the moment I'm trying to build complex reusable networking layer with Combine. Boy it's not the easiest thing. Real life apps usually starts with some sort of intro view then login and then tab view or navigation with lists, sheets and popovers. Every tutorial shows list view with some detail view and trying to teach mvvm. 🤦♂️
@miff783 жыл бұрын
Great short and precise, it would be great if you make similar with MVVM - Coordinator for Swift UI
@abrarwiryawan4 жыл бұрын
Cool vid, i hope you do MVVM Compose and how to test them sometime in the future
@NotoriousGarage4 жыл бұрын
Thank You for the Christmas gift. 🎄🎅🏽🎄🎁🎁🎁
@eichenherzmo3 жыл бұрын
This is so freakin great
@olegnaumenko48712 жыл бұрын
Thank You for this lesson! However, I don't get that manipulation with StateObject() in the init() of the UsersView. In my opinion, that's not needed, because you already did it in the line: "@StateObject var viewModel = ViewModel()". This effectively creates a property of class StateObject with a property wrapper of our view model, and assigns it to var _viewModel. Please correct me if I am wrong. My code is working fine without all this init() thing, even with completion delay in AppDataService.
@burakyildirtan1660 Жыл бұрын
Hey Great Video! Greetings from Germany👋🏻 After watching your Video I still have a question left. What if you have multiple VMs / Views and you want to get Data from the network connection ? How do I prevent that I am requesting the data for every VM again?
@stephanusschoeman94133 жыл бұрын
This is one of the best explanations of MVVM I've seen since Microsoft started with it in WPF back in the early 2010s. Would you say that data added to the ViewModel should already be processed and business logic not applicable to the view should be kept to a minimum? I think this is where most people run into trouble. They have a light View but the ViewModel suddenly becomes bloated. Thank's Loco Great Video
@acjazz012 жыл бұрын
For small projects may be uncommon using viewmodel in more than one view, but for big projects, it's not. MVVM says that ViewModel must be agnostic, putting inside a view extension you're creating a strong connection between them. Let's say that you have in your project a product viewmodel which lists products of your store (all or filtered). You can have some views that show those products, but in this approach showed in this video, this will fail miserably.
@matrosovdeveloper Жыл бұрын
Not sure what the issue with putting viewModel in extension. It is not strong relationship as it is a protocol based viewModel. So you have separate class view which handle UI and you have viewModel which contains business logic. So getUsers will be executed in separate viewModel place and UI will be updated when users array will get new state of values. I don’t see there is any strong relationship. Could you provide code example you are referring as a potential strong connection?
@wesleybritob4 жыл бұрын
Great video, this kind of content makes the difference. If you find a way to change statusBar dynamically please let me know =]
@Kilo_Loco4 жыл бұрын
Haven’t tried changing it yet but I’ll look into it 😉
@JamesHaleyRentingAmerica3 жыл бұрын
What do you do when you have two ViewModel that you have to use on the same screen?
@rillieux17923 жыл бұрын
Great video. What should I do to implement the same MMVM patterns with CoreData? I'm not getting the idea with the AppDataService use and the preview injections. Can you give any pointers?
@tranminhhaifet3 жыл бұрын
why the preview does not work with DispatchQueue.main.async?
@yisseldarhoc85253 жыл бұрын
This is such a useful video, it definitely helped me refactor my project. Can you go more into details about the manager singleton? How would you test the view? How would you add a layer to handle offline mode?
@Kilo_Loco3 жыл бұрын
Sure thing! I plan on doing more testing videos in the future github.com/Kilo-Loco/content/issues/29
@yisseldarhoc85253 жыл бұрын
@@Kilo_Loco Awesome, looking forward to them :)
@crimsondragon953 жыл бұрын
How do you handle error messages via alert? Or updating the view based on changes on the view model?
@seriouslysupersonic3 жыл бұрын
Interesting tutorial. It's funny I also started declaring the ViewModel as an extension of each view on my projects a while back as it helps structuring the code! I wonder however if you shouldn't use the @ObservedObject property wrapper whenever your view receives a view model object that is own by another view. The @StateObject property wrapper also deals with instantiation of an ObservableObject which in this case does not seem to be necessary if you already have a ViewModel object to pass to the init.
@Kilo_Loco3 жыл бұрын
Very cool!
@hosseindastan62214 жыл бұрын
thanks. why did u use weak self? in this case ur UsersView is struct and there is no memory leak for struct am i wrong?
@pratamaramadhan97694 жыл бұрын
Thanks, kilo! But if you put a loading view while fetching the data, it would be perfect haha
@danielwatson65293 жыл бұрын
So ive been using this method for a while and its great. like contentView with a @stateobject - its view model which is an extension. today im playing around with having the content view as an extention of the view model. it seems to work quite well, and eliminates some passing around in a few ov my projects, just wondering if you, or anyone here had tried that out
@alvin31719973 жыл бұрын
Looks similar to Filedstack MVVM setup for flutter! Gotta learn some iOS development using the same setup :D
@Kilo_Loco3 жыл бұрын
There’s a lot of stuff that can be shared between the two since they are both declarative
@sami7903112 жыл бұрын
Great video! Just one thing - “sot” is actually “sut” system under test.
@TheDancing0wind2 жыл бұрын
When testing view model the problem is not the async in the "production" - the problem is that we are not interested in testing API service (and probably a bunch of extra stuff that it depends on). But we still want to have real life like async behaviour. Removing this async behaviour from tests bad. ( xcode has built in test for async results)
@moosegoose12823 жыл бұрын
some ppl say use redux. thoughts?
@eldarkk45663 жыл бұрын
Hello buddy. Where are you man?
@nebulousJames123453 жыл бұрын
I feel like having a protocol for ViewModel would be better :D
@Kilo_Loco3 жыл бұрын
I generally prefer to only use protocols on things that will be reused. Also, dealing with protocols and published properties is kinda messy.
@nebulousJames123453 жыл бұрын
@@Kilo_Loco good to know. I typically always expect views to be reused, because if I dont write them in a manner that they can be reused, they wont be :). I’m coming from reactive swift, so ill definitely look into published properties in protocols. Thanks for the heads up!
@morpheus45643 жыл бұрын
TDD ? :)
@Eugene.Berezin4 жыл бұрын
Wait, you didn’t stop and re-record the entire video because of 1 typo?! Lol 😂 jk jk. It’s a super dope video tho! I like how you explain mocking!
@Kilo_Loco4 жыл бұрын
Lol hell no! Honestly, besides that mess up, I thought this video nailed it
@nyambe3 жыл бұрын
I am find it a bit hard to see a real advantage of mvvm vs reusable components architecture
@arsars39963 жыл бұрын
learn DI
@Kilo_Loco3 жыл бұрын
What do Dinosaur Igloos have to do with any of this?
@williamstorey50243 жыл бұрын
how come you didn't declare the view model in the usersview as @observableobject? instead you used state?