How to use MVVM with Async Await | Swift Concurrency #14

Поделиться
HTML-код
  • Опубликовано: 31 июл 2024
  • Discover the power of combining MVVM architecture with Swift Concurrency and async await to build robust and efficient iOS apps. Learn step-by-step how to implement the MVVM pattern in your Swift projects and leverage the benefits of concurrency for seamless user experiences. Level up your coding skills and create high-performance apps with this comprehensive guide.
    🤙 WELCOME BACK 🤙
    WEBSITE: www.swiftful-thinking.com
    DISCORD: / discord
    GITHUB: github.com/SwiftfulThinking/
    SAY THANKS: www.buymeacoffee.com/nicksarno
    00:00 MVVM
    00:00 Intro
    01:12 Welcome back everybody!
    07:32 MVVM

Комментарии • 19

  • @farhad28881987
    @farhad28881987 Год назад +9

    Hey Nick,
    It would be GREAT if you can add a new video showing how to write unit tests for viewModels having async await functions.
    You are AWESOME 👏

  • @xybnedasdd2930
    @xybnedasdd2930 Год назад

    I like how Swift Concurrency is taking all the good things from Kotlin Coroutines (context switching behind the scenes, async streams) and doing it in its own flavor.

  • @coder7322
    @coder7322 Год назад +2

    So excited to watch this, been thinking about architecture a lot recently. Would be keen to see more content from you on architecture/design patterns 🤓

  • @antontikhonov5028
    @antontikhonov5028 8 месяцев назад +2

    Great videos, Nick! One small issue with creating tasks inside the view model in order to keep the UI synchronous is that it makes it harder to unit-test it. For instance if updateData() was an async function, all you would need to do in the test is to await and check data property. Otherwise you will probably need to convert the data property to an async sequence and await until it emits a particular value or times out.

  • @bonifacy9511
    @bonifacy9511 Год назад

    THank you Nick for all of your hard work!

  • @oleksandrstepanov6652
    @oleksandrstepanov6652 Год назад

    The best! Thanks!

  • @user-eg7ep8db8j
    @user-eg7ep8db8j Год назад

    wonderful video, thanks!!

  • @AdailtonSilvaSP
    @AdailtonSilvaSP 4 месяца назад

    tks for this video! I am going to use it on my project

  • @thaisfernandes7498
    @thaisfernandes7498 9 месяцев назад

    You are awwwwesome. Me and my colleagues are always waiting for you to upload new videos. Thanks!!

  • @tmjromao
    @tmjromao Год назад

    Many thanks for making, publishing, explaining how to implement the MVVM pattern in Swift. Could you do other(s) explaining the edge cases you mention?, Many thanks, best regards

  • @rahulchaurasia5011
    @rahulchaurasia5011 Год назад

    thanks for wonderful video ... we need more on mvvm pattern please make with realtime api

  • @asadchattha3470
    @asadchattha3470 3 месяца назад

    Thanks Nick

  • @vncsnts_
    @vncsnts_ Год назад

    In a case I want to pass an EnvironmentObject from the view to view model, for example a service that is passed as an environmentObject, what is the correct way to pass that to the vm so only vm does the actions

  • @ShooMPozitiV
    @ShooMPozitiV 11 месяцев назад

    And how it will work if I tap button many times? I have to cancel previous task before? If I will have many functions with different things will I have to do many task variables for this?

  • @lincolndickerson1293
    @lincolndickerson1293 Год назад

    First the separation of managers and viewmodels is critical. It really cleans up so much code.
    Not saying never, but I have found .onAppear, .task, and .onDisappear can be problimatic for manager code because a view “appears” and “disappear” more often than you might suspect and enhancements may cause them to fire at the wrong times.
    .task is sometimes described as onappear with a Task built in. There seems to be some subtle differences
    After working through the Firebase playlist so much became clear.
    Pre loading on startup for environment objects, Creating and loading and then injecting observed objects from one level up then reloading on user actions in the view is much more stable and drives down the psychometric complexity and far less business logic in the view.

  • @user-kn6fg4yv2w
    @user-kn6fg4yv2w 9 месяцев назад

    so confused video

  • @brandonhopkins3438
    @brandonhopkins3438 Год назад

    Strange because when I put the whole class on @MainActor, the main view complains. But if the @MainActor is on the private(set) and on the Task, it doesn't 😢