How to use MVVM in iOS - State Management and Data Flow through SwiftUI - Example Refactoring Swift

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 130

  • @sanyamjain7058
    @sanyamjain7058 หลายเดือนก่อน

    I'm primarily a JavaScript developer with around 2 years of experience, but I've recently been onboarded to an iOS project. Your assistance has been a lifesaver for me. I haven't been able to find this type of content anywhere on the internet, not even in paid courses. Thank you so much again, and bless you!

  • @danielrybak4899
    @danielrybak4899 3 ปีที่แล้ว +55

    The work that you put into this is simply amazing... I really hope you do more content!

  • @cortana2388
    @cortana2388 3 ปีที่แล้ว +6

    I have watched many tutorials, they felt like the tutor have read something and delivering to us. But in this it feels like the content is created by her. Love from India.

  • @DavidRoth
    @DavidRoth 3 ปีที่แล้ว +10

    PhysicsNerd is a treasure. This is a great accelerated walkthrough. I especially liked the clean code organization and the inclusion of basic unit tests. Great stuff.

  • @christianredlich1305
    @christianredlich1305 3 ปีที่แล้ว +9

    The First MVVM-Tutorial, which I completely understood... Thank you for your work and nice and understandable drawings.

  • @anantdesai3293
    @anantdesai3293 3 ปีที่แล้ว +3

    I love the way you put all the things separately and properly while explaining. Thanks for this tutorial. I was totally confused about the SwiftUI lifecycle and structure. But after watching your videos, it helps me to understand it easily. Right now I can say that I have some better idea about the SwiftUI. Thanks once again. ❤️

  • @manwithllama
    @manwithllama ปีที่แล้ว +1

    Your drawings are so helpful! Especially the one at 9:59. That feels to be really clicking for me. Thank you for putting all the hard work into this video.

  • @ekadam
    @ekadam 2 ปีที่แล้ว +2

    Many many thanks for your videos. Especially the details you go into with so many diagrams. Please continue doing so. When my first app goes live, I hope I can donate a part to you and other amazing teachers I learnt from.

  • @francislegaspi2923
    @francislegaspi2923 3 ปีที่แล้ว +5

    Wow as an Intermediate~Advance iOS Developer, this is very concise and easy to understand, straight to the point, I love when you explaining with drawings, you're a natural Teacher, Thank you Karin! you earned my Subscription :D

  • @tradingguy1004
    @tradingguy1004 3 ปีที่แล้ว +3

    You are a great teacher, and these tutorials are really helpful and very informative...pleas keep on posting many many more of them :)

  • @nickcostello2810
    @nickcostello2810 3 ปีที่แล้ว

    I think I've watched this three times now. I watched it two months ago when I first started my app. Lost appreciation for MVVM. Now that I have a fairly complex app... my appreciation is back.

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว

      I am very happy that you could gain this understanding. It is hard to show a larger project in a tutorial.
      But this is exactly when MVVM helps to organise the code.

  • @kevinmichaelallen1
    @kevinmichaelallen1 ปีที่แล้ว

    This is exactly what I've been searching for. I'm have a lot of experience with MVVM in C# WPF applications. I'm starting a new project on iOS and this video gives me everything I need to get to work.

  • @williamallen4607
    @williamallen4607 3 ปีที่แล้ว +1

    You have a great skill for teaching. Your explanations are so detailed and helpful. Thank you.

  • @garymcc3748
    @garymcc3748 ปีที่แล้ว

    Really enjoying your courses Karin. Thank you!

  • @jockeb7393
    @jockeb7393 3 ปีที่แล้ว +2

    Thank you for this! You are an excellent teacher! 👍

  • @hcri
    @hcri 3 ปีที่แล้ว +1

    You are a very good instructor. Wishing you good luck and I will be following you closely.

  • @James-z4c5o
    @James-z4c5o 10 หลายเดือนก่อน

    Superb content Karin, helped me immensely x

  • @Titanman316
    @Titanman316 3 ปีที่แล้ว

    This was exactly what I needed to fully understand how to do MVVM is SwiftUI. Thanks so much!!!

  • @danialothman
    @danialothman 7 หลายเดือนก่อน

    what a wholesome video, thank you Karin!

  • @pgong415
    @pgong415 ปีที่แล้ว

    Hi Karin, thumbs up! amazing! Thanks a lot for your efforts for this fantastic video! Absolutely useful! Great!

  • @KimbrellBrad
    @KimbrellBrad 2 ปีที่แล้ว

    Love listening to your videos but I cannot take the bright white screen. Would you consider using dark mode? Most agree that the contrast is much better and easier on the eyes. I haver glaucoma and it is tough with sight only in my right eye. I appreciate what you do and either way will continue listening!

  • @ChuckDiggins
    @ChuckDiggins 3 ปีที่แล้ว

    You are very thorough. It helps as you think out loud as show your drawings. Thank you.

  • @evennorthug2585
    @evennorthug2585 3 ปีที่แล้ว

    This works for me. Momentum and depth. Keep up the good work!

  • @DonJon200
    @DonJon200 หลายเดือนก่อน

    Great content! Thank you for posting it

  • @blueducktrading
    @blueducktrading 3 ปีที่แล้ว +1

    This is brilliant. Thank you for providing such a detailed overview of MVVM, providing an example and simplifying it all to make it really easy to understand. I have been looking for something just like this!
    Another video very similar to this showing people how to do exactly the same process, but with Firebase: FireStore read/write etc. instead of local data would also be a great addition in my opinion. There really isn't any videos that i've managed to find that break firebase down into a simplistic app...I think people would benefit greatly from it.
    Thanks again.

  • @mafiaboy16
    @mafiaboy16 2 ปีที่แล้ว

    The way this Tutorial is setup, is super and i just want to learn more

  • @samurai7938
    @samurai7938 ปีที่แล้ว

    I am treated up for your videos. Please keep it up.

  • @ricardokuster
    @ricardokuster 3 ปีที่แล้ว

    Hi Karin, love the way you explain things ! Like a PRO ! Merci beaucoup !

  • @mojota6938
    @mojota6938 3 ปีที่แล้ว

    Fantastic presentation. Everything is super clear, thank you very much!!!

  • @stanleymiller1181
    @stanleymiller1181 3 ปีที่แล้ว +1

    Excellent detailed explanation. Much appreciated.

  • @bonnydonny
    @bonnydonny 3 ปีที่แล้ว +1

    I love the whole thing, especially the diagrams and high level overview. Great pace. Thank you!

  • @OIP_1
    @OIP_1 ปีที่แล้ว

    this is an awesome overview, thankyou!

  • @fredrigaudeau
    @fredrigaudeau 3 ปีที่แล้ว +1

    This video is by far the best I could find to finally understand MVVM and property wrappers. Thanks a lot.
    I have small side question regarding the Test project: when you added the ZStack, the background of the app became gray. I couldn't figure out how to make it back to white. Why did it became gray and how to change it?

  • @ashoms0a
    @ashoms0a 3 ปีที่แล้ว

    Very well explained! Thank you!

  • @MayurPatilishere
    @MayurPatilishere ปีที่แล้ว

    Thanks for such an informative tutorial.

  • @arsenidziamidchyk2972
    @arsenidziamidchyk2972 3 ปีที่แล้ว

    Reaaally good tutorial, thanks a lot!

  • @sebastianstaszczyk5240
    @sebastianstaszczyk5240 3 ปีที่แล้ว +1

    Awesome tutorial! You are the best. 👍
    If you have time, I would be very grateful for showing how to use MVVM with CoreData in SwiftUI. Thanks!

  • @muncho404
    @muncho404 2 ปีที่แล้ว

    Your tutorials are 💎

  • @SuInTheDev
    @SuInTheDev 3 ปีที่แล้ว

    wow, this is so nice explanation!

  • @chrisual
    @chrisual 3 ปีที่แล้ว +2

    This is an amazing video. Are the diagrams your own? They should be in the official docs!

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว

      Thanks for the nice words. The drawings are all mine. If the official docs get more images like these, I would be super happy too. I need to see visuals to understand.

  • @Grepsoft
    @Grepsoft 2 ปีที่แล้ว

    Good explanation and the diagrams were really well done. Thank you for the content.

    • @SwiftyPlace
      @SwiftyPlace  2 ปีที่แล้ว

      Glad it was helpful!

  • @patratacus
    @patratacus 2 ปีที่แล้ว +1

    Great video! This helps me a lot in learning MVVM. Would you be able to update this for Xcode 13 and SwiftUI 5? NavigationView has drastically changed so a lot of the codes here no longer function as well.

  • @jonathanpiette
    @jonathanpiette 2 ปีที่แล้ว

    Amazing! Thank you for this video of quality

  • @tharindudarshana6480
    @tharindudarshana6480 2 ปีที่แล้ว

    Thank you very much. Amazing tutorial ♥

  • @multitudes389
    @multitudes389 3 ปีที่แล้ว

    with tests as well! truly a treat. Thank you!

  • @emresancaktaroglu6430
    @emresancaktaroglu6430 3 ปีที่แล้ว

    Hello,
    First of all, thank you for your information. I don't understand how you did it in 45 min. But, you have explained all of the critical information about MVVM, Property Wrappers, SwiftUI etc. You are a really incredible teacher. If you speak a little slower than normal it would be perfect for people whose doesn't native language is English. I watched with 0.75 :)
    I became your huge fan!

  • @Pro-jz8wg
    @Pro-jz8wg 3 ปีที่แล้ว +1

    big thanks for your work!!great tutorial!!!
    how can I get this wonderful SwiftUI road map?)
    //I really need it

  • @ZachMatics
    @ZachMatics ปีที่แล้ว

    Gorgeous. Subscribed!

  • @kamilap3404
    @kamilap3404 3 ปีที่แล้ว

    Thank you!! it was really helpful

  • @TheDALLADER
    @TheDALLADER 3 ปีที่แล้ว

    Great work! I hope this video gets more attention.

  • @dimitrikirillov2913
    @dimitrikirillov2913 3 ปีที่แล้ว +1

    Thanks! Herzlichen Dank! Sehr informativ. Keep up good work!

  • @foggydawning9268
    @foggydawning9268 2 ปีที่แล้ว

    Wow! Amazing video !!!

  • @pepesilvia1055
    @pepesilvia1055 3 ปีที่แล้ว

    great video! thanks for making it 👍😘

  • @valentine1925
    @valentine1925 3 ปีที่แล้ว

    I love your drawing/diagrams!! Thank you so much!!

  • @brunokd2
    @brunokd2 ปีที่แล้ว

    Very good video. How can I modify the state of a view model from another view model? Should I do it or do it from another way?

  • @mu.abdelhamid
    @mu.abdelhamid 2 ปีที่แล้ว

    Thank you. You explained it very well! Where should I create other view models? For example, I want to create another view model for editing items, so the model will represent a single item. Should I create an instance of that view model inside the main view model, or in the view itself or something else?

  • @Flintalt2
    @Flintalt2 3 ปีที่แล้ว

    Fantastic video, very nicely explained and great visuals describing everything! Thank you

  • @javigarcia-ripoll6578
    @javigarcia-ripoll6578 3 ปีที่แล้ว

    You're the best! Thank you!

  • @AMchou
    @AMchou 3 ปีที่แล้ว +1

    Hi,
    Thanks a lot for the info, it was very helpful. When you create the Navigation Link for the name, if you wanted to have a more detailed view and perhaps edit details of "name" would it be necessary to create an entirely new view or could we incorporate a func in the VM to do so?

  • @aleksandrkravtsov8727
    @aleksandrkravtsov8727 4 หลายเดือนก่อน

    perfect explanation

  • @UMBerto-wj7ch
    @UMBerto-wj7ch 3 ปีที่แล้ว

    Superb video, right to the point!

  •  3 ปีที่แล้ว

    Dear Karin, great content, thank you :-)

  • @SwiftyPlace
    @SwiftyPlace  3 ปีที่แล้ว +1

    If you prefer a written tutorial, you can go to my new blog www.swiftyplace.com/blog/swiftui-and-mvvm. The code and images are available too.

  • @saradrada
    @saradrada 2 ปีที่แล้ว

    This is amazing💖thank yo so much!

  • @Histats71
    @Histats71 3 ปีที่แล้ว

    This work is amazing. Thanks for everything

  • @developer8995
    @developer8995 3 ปีที่แล้ว

    You did a great job 👏 thank you very much! May I ask, are you from Germany ?

  • @a3r0phil
    @a3r0phil 3 ปีที่แล้ว

    Nice work! May I ask what do u use for these beautiful diagrams?

  • @jarodpaulson9439
    @jarodpaulson9439 3 ปีที่แล้ว

    Hi Karin, great video, thanks so much for making it. I did have a question about some other file groups that I have seen in people's project, like services, extensions, utilities, and repositories. How do these elements fit into the MVVM blueprint you've discussed here? Thanks.

  • @tttopcattt
    @tttopcattt 3 ปีที่แล้ว

    Hi Karin, thank you for providing such clarity on this subject. Suppose you want to maintain persistent data in a json file. What might be the simplest method to maintain one 'persistent' data source? My efforts are fraught with mutability issues. TIA

  • @jiaweil902
    @jiaweil902 3 ปีที่แล้ว

    Thank you so much! It's easy to understand!! I really love those faces!

  • @jayantkumar1954
    @jayantkumar1954 2 ปีที่แล้ว +1

    amazing!!

  • @amphortas1
    @amphortas1 2 ปีที่แล้ว

    Thank you very much for your amazing work! May I ask you a question please? If I wanted to have a list of words (for example, English words with translation) already pre-populated, is it okey to use such an approach with a StateManager.fullState() or what is a best approach for such this cases?

  • @The1tjc
    @The1tjc 3 ปีที่แล้ว +1

    Cool visuals!

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว +1

      All done on my iPad with my Apple pencil. Feels like I can use a white board. 🤓

    • @TechRagh
      @TechRagh 3 ปีที่แล้ว

      Done using Procreate on ipad? Very nice visuals. Please do more videos on SwiftUI

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว

      @@TechRagh Procreate is to much functionality for me. This is made with my own app. Still very buggy. But you can try it here apps.apple.com/us/app/assocy-the-genius-notebook/id1464579365

  • @thomasvalter333
    @thomasvalter333 3 ปีที่แล้ว +1

    This is indeed a fantastic tutorial. Even as a beginner, I understand most, thank you!
    One question if you (or others) don't mind.
    You have talked about how a ViewModel interacts with a View.
    But what do you do, if you have two ViewModels and want them to interact?
    I have tried in ViewModel A to add ViewModel B as an @StateObject (get an error: )
    weird

    • @asseeger
      @asseeger 3 ปีที่แล้ว

      That's a good question that I have asked myself as well-I guess what it comes down to is to find a spot in your application where you have access to both of the view models (most likely the spot where they are created), passing down a reference to the respective other view model. Those could be optional properties, I guess.

    • @pandalanhukuk804
      @pandalanhukuk804 2 ปีที่แล้ว

      You should go one more time to the Video all the drawings. To ViewModel is interacting with the Model.

  • @girishadapa90
    @girishadapa90 3 ปีที่แล้ว

    Your way of explanation 🎉 something special madam 👍

  • @berkc5323
    @berkc5323 2 ปีที่แล้ว

    you are amazingg thanks!!!

  • @ksufed8918
    @ksufed8918 3 ปีที่แล้ว

    Very helpful, thanks a lot! ❤️👍

  • @paulfranco5733
    @paulfranco5733 3 ปีที่แล้ว

    I really enjoy your content.

  • @schmittsfn
    @schmittsfn 3 ปีที่แล้ว

    Really enjoying your videos. One thing that would interest me is how one would combine MVVM with the Coordinator pattern in modern Swift. Or are there better patterns for navigating in huge projects?

  • @cassenhari3992
    @cassenhari3992 2 ปีที่แล้ว

    you are the greatest have a good year

  • @SOK-gn6hw
    @SOK-gn6hw 2 ปีที่แล้ว

    Hi in the beginning of the video there is a beautiful road map. How can I reach that ?

  • @monacvelf3124
    @monacvelf3124 3 ปีที่แล้ว

    Hi Karin, deine Art zu erklären gefällt mir wirklich sehr gut. Ich würd mich sehr freuen, wenn du ein Video zum Thema APIs machen könntest. Vielleicht auch mal eine Zusammenfassung deiner liebsten Swift Bücher/ Lernunterlagen, Tipps etc.
    Weiter so!

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว +3

      Hi Mona, freut mich dass dir meine Erklärungen gefallen. Ich wollte noch ein paar Videos zu Combine machen und die integration mit Core Data und realm. Ich werde mal sehen was ich für ein video zum Thema "Wie kann man Swift und UIKIt / SwiftUI lernen" machen kann.

  • @AkamiChannel
    @AkamiChannel 3 ปีที่แล้ว

    Excellent video. If you could do dark mode, reading the code would be a little easier on the eyes.

  • @cuongnt04230
    @cuongnt04230 3 ปีที่แล้ว

    Could you share the image swiftui roadmap? Thanks

    • @LeviM337
      @LeviM337 3 ปีที่แล้ว

      It's in her description: karinprater.medium.com/on-the-road-to-learn-swiftui-8b26b528199c

  • @jordibruin
    @jordibruin 3 ปีที่แล้ว

    Very clear, thanks a lot!

  • @cozybazaar
    @cozybazaar 2 ปีที่แล้ว

    you're amazing! thank you thank you thank you :)

  • @asseeger
    @asseeger 3 ปีที่แล้ว

    Awesome content, thanks a lot! What is your solution to handing down instances to the detail view from a list to let the user make changes (like e.g. changing the todo's title-as your are handing down an unmutable instance from within the closure, you do not have a binding... Right now, I create a binding myself in the detail view by finding the instance via it's `id` in the view models array, but I do wonder if there is a better way to do this...

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว +1

      I think changing the item in the item array by id, is a feasible approach. Not sure if there is a different way because your data always is represented by this data array and that is the one that needs to be changed.
      For the title I would have an extra @Published property in the view model. In order to let the user change it, I would show an extra editor view with a textfield. The view gets access to the view model with @ObservableObject or directly to the view models property with @Binding.

  • @HilaProdomo
    @HilaProdomo 3 ปีที่แล้ว

    Thank you for this video. Where do you manage @FetchRequest with CoreData? IMO it should go in the ViewModel. Or do you use it in the View directly?

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว

      It would be great if we could use @FetchRequest in a view model. This will not work because it needs the NSManagedContext that has to be added in the environment with .environment\.managedObjectContext, context)
      Core Data with MVVM is a bit more tricky. I explain more about it in this Core Data specific tutorial th-cam.com/video/63oyC5bUujc/w-d-xo.html

  • @amphortas1
    @amphortas1 2 ปีที่แล้ว

    Do you have any Udemy courses, I will be happy to buy it and study from you! Your explanation is awesome! I finally understood MVVM approach with CRUD (Create, Read, Update, Delete) operations and example of simple tests! Amazing training!

  • @LucasFernandesSilveira
    @LucasFernandesSilveira 3 ปีที่แล้ว

    Awesome content! Thanks 😊
    Is this presentations available download for further checks?

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว +1

      I summarised the video in this blog post www.swiftyplace.com/blog/swiftui-and-mvvm. You can find all the images there.

    • @LucasFernandesSilveira
      @LucasFernandesSilveira 3 ปีที่แล้ว

      @@SwiftyPlace great! I’ll check it out. Thanks for this 👏

  • @abdullohbahromjonov781
    @abdullohbahromjonov781 9 หลายเดือนก่อน

    3:00 background cat >>>>>>

  • @test-t-e8s
    @test-t-e8s 3 ปีที่แล้ว

    good!! Awsome lecture!

  • @napalm_exe
    @napalm_exe 3 ปีที่แล้ว

    Amazing tutorial. I come from an Android background but this was definitely easy to follow along. Would definitely pay for any courses you have if they're anything like this.

  • @andrewiglinski148
    @andrewiglinski148 3 ปีที่แล้ว

    PhysicsNerd?!?! I majored in Physics and I'm just now getting into Swift after working with Kotlin and Node for a while. What got you into development instead of working in something like academia related to physics?

  • @AkamiChannel
    @AkamiChannel 3 ปีที่แล้ว

    Is there somewhere we can see that huge outline of swiftui stuff that we see in the beginning of the video?

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว

      I have a video "SwiftUI roardmap" where I talk about it th-cam.com/video/5bdzffoilxU/w-d-xo.html. You can download the pdf file from this link www.swiftyplace.com/f/swiftui-roadmap

  • @--..FC..--
    @--..FC..-- 2 ปีที่แล้ว

    nice work

  • @AndrewDChristie
    @AndrewDChristie 9 หลายเดือนก่อน

    Thanks!

  • @saeedhajizadeh5552
    @saeedhajizadeh5552 3 ปีที่แล้ว +1

    The cat in the background is sooo cute that I can't focus on the actual tutorial

    • @SwiftyPlace
      @SwiftyPlace  3 ปีที่แล้ว

      That is Louis job as cohost. He is very good at being cute. 🤩

  • @mika_chu
    @mika_chu 3 ปีที่แล้ว

    so Model is only a data structure and not the Data itself, no? It seems that ViewModel is who stores the Data. ?

  • @alanyang8752
    @alanyang8752 3 ปีที่แล้ว +1

    Thank you