Breaking Down My SwiftUI Async Await MVVM Project Structure & SwiftUI Architecture: SwiftUI Tutorial

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

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

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

    Your deepdives into “why I do it this way” are incredibly helpful.

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

      So glad you picked up on this since this is the main aim of this and all of my videos, to show off my thought process. I'm glad you enjoyed the video.

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

      @@tundsdev I'm only at 4:50, and a beginner, and love how you explained why you used an enum vs a struct for the api url. Smart! And… I've noticed the thing many videos miss is the rationale-the why. Which is so important. Excited to learn from you!

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

      That’s great to hear 👌🏾

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

    I like the technique where whatever you write in code, you explain its importance, just like dependancy injection in this video. Superb!

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

    love the camera, can really see you explaining things and follow along

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

      Glad you enjoy the video 👌🏾

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

    Excellent presentation. Clear and practical and chalk full of great tips and information.

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

      Thanks Stewart, I really appreciate the positive feedback 👍🏾

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

    Just found your channel after learning UIKit and deciding that I wanted to take the dive into SwiftUI. Really helpful content, the way you lay out your reasoning behind things has been super helpful with trying to wrap my head around some of these new concepts.

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

      Glad you enjoy my concepts 🤝

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

    Your style of explaining the "why:" of the "what" you are doing is excellent! This content is going to help so many of us that have followed others without fully understanding the entire subject. Great reference to prior videos that build upon this one. Thanks for what you are doing for the community!

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

      Thanks i’m glad you enjoyed it 👌🏾

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

    Nice to see async/await in action. The API call looks very clean.

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

      Thank you 👍🏾

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

    Thank you for a great tutorial. I agree your deep dive explanations make you stand out way above the average swift cast and make you an awesome teacher.

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

      Thanks I really appreciate that

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

    I just wanted to say thank you Tunde for taking the time to do that video. It was incredibly helpful, I guess as close to pair programming as I will get for a while. To allow me to see the process in progress, and decisions to refactor on the fly was really helpful. (I guess I’d go slightly further getTenRandomQuotes() so clear what it’s returning). Often I question myself as I go: should I do X, would it be better to do Y, and if I spent the time properly planning then Z … and then I do nothing at all because I lack the belief in my choices.
    You give me that bit more confidence to go with what I’m doing, and knowing that I can and should totally refactor as I go.
    (Aside, I hope you release source code for this video too when you have the time)

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

    You knocked this one out of the park man! Great tips and practices used in this vid!! Well done bro!!

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

      Thanks bro, I really appreciate the positive feedback

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

    I've just found your channel and it's a hidden gem! It shows that every video you create is well thought out and sharing your thought process is incredibly helpful. Thanks for the great content and keep up the good work!

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

      Thank you I really appreciate that 👍🏾

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

    Great job on the video. I honestly am still a complete beginner at Swift and SwiftUI, but watching your video kinda helps me better understand your logic on how you do things, and even if I don't take much away in terms of understanding the more technical aspects of what you are doing, I can easily take away how you structure the code of your app in an easily understandable but very detailed hierarchy of files. Ill definitely be back to watch more of your content.

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

      Thanks glad you enjoyed and i have loads more beginner content, i can’t wait to share with you 👌🏾 and you got this, this video aint going nowhere so feel to rewatch and ask questions anytime 👍🏾

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

    Man I've just seen your video about async and was about to recommend an "app structure" video, but you have already done it! Great! Thank you for all the great videos, your teaching style is the best.

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

      Thanks & I’m glad you enjoyed it 👍🏾

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

    This is really the type of stuff I've been looking for. Thanks!

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

      Thanks, glad you enjoyed it 👍🏾

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

    I didn’t know you can create a namespace with enums. Thank you so much for the tip, mate.

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

      No worries, glad you found a useful tip 👌🏾 and thanks for watching 💪🏾

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

    thank you so much! your explanations are very helpful as a lot of others have said.

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

      Thanks 👍🏾

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

    This is exactly what I have been looking for! Just subscribed. Love seeing fellow Nigerians in tech.

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

      Thank you and I appreciate it, fellow Nigerian representing 🇳🇬🇳🇬🇳🇬

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

    Awesome content, you just made me understand how to actually build an app. Thanks for sharing 😃

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

      That’s great glad I could help, also check out the source code too for this and my other videos on my github for a deeper understanding 👍🏾

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

    Thank you so much!! This is the best tutorial!

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

      Glad you enjoyed the video 👌🏾

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

    excellent video again, underated content cheers

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

      Thanks 👍🏾

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

    Outstanding tutorial!

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

      Thanks 🤝
      Also if you didn’t know I have a complete SwiftUI & MVVM playlist with even more videos teaching you everything you need to know and how to work with different flavours too.
      You can check it out below
      SwiftUI MVVM Example (SwiftUI MVVM Tutorial | Beginner Level)
      th-cam.com/play/PLvUWi5tdh92wy3DEZk_NL207DgQs_xtq_.html

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

    Very well explained tutorial!

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

      Glad you enjoyed the content 👌🏾

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

    Excellent presentation. I learnt a lot of things. Especially your why reasons. Thank you :)))

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

      Glad you enjoyed it 👍🏾

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

    A very detailed explanation thankyou

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

    Great tutorial. Thanks.

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

      Thanks 👌🏾

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

    Excellent stuff! I just found out about your channel and I love it! I haven't had the time to check all the video but do you have anything regarding the text field implementation to allow the user to insert their API and not make it hardcoded? Thanks in advance and keep up the good work, you rock!

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

      Thanks 👍🏾

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

    Awesome Tutorial !

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

      Thank you 👍🏾

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

    AMAZING video, bro. Tks a lot!!!

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

      Glad you enjoyed it 👌🏾

  • @michael-eb5uf
    @michael-eb5uf 3 ปีที่แล้ว +1

    Thank you for your insights.

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

      Thanks, glad you enjoyed 👍🏾

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

    Great work man, thanks!

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

      Thanks 👌🏾

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

    Great stuff. Question, is there a way to display the rows as they come in instead of displaying all the rows at once?

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

      Hey I actually have a video coming out on the 11th of April that shows you how to do this with AsyncImage. You could apply that same logic onto your view so keep an eye out for that.

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

    Very well explained ... Thanks to @Stewart for sharing the link on Twitter ...

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

      Thanks 👍🏾

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

    Thanks for your nice video..
    Is there a specific reason why QuetesServiceImple is class not struct?

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

      Thanks and because its an observable object it needs to be a class so we can observed changes to it, because it is a reference type & structs are value types and update our UI accordingly. I go over it in this video.
      th-cam.com/video/8y-25GlPmmU/w-d-xo.html

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

    Great video.

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

      Glad you enjoyed it 👌🏾

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

    How often do you unit test your view/screen files? (I am assuming this is why you created a protocol for the ViewModel). Is there any other reasons besides unit testing that lead you to create a protocol for the View Model?

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

      Good question, I’m yet to actually unit test my view and screen files. I actually don’t create the protocols for my screens its mainly so I can unit test my view model & services independently or together since I test the business logic and service of my apps. One day i’ll look into unit testing views in SwiftUI.

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

      @@tundsdev So what does the ViewModel protocol help with then other than testing the UI?

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

      In the event I need to unit test a store that holds multiple view models, I have multiple view models that have a similar function i’d like them to implement. It’s extra boilerplate in some cases but for me just a habit for me to use protocols that i’ve picked up.

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

      @@tundsdev Yea makes sense. Thanks for your input!

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

    Hi man, is your company develop using Objective-C, lol? My last company uses swift, but my new company uses Objective-C.

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

      Nope lol

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

    Really thanx!
    U re crack!

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

      Thanks 👍🏾

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

    Thanks, bro. and can you do another video working with Alamofire?

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

      Added to the list 👌🏾

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

    Yes, I am interested in how actually protocol making life easier for unit testing? What is mean by fake our service class?

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

    At around 25:55, the QuotesScreen view is responsible for injecting a quotes service impl into the QuotesViewModelImpl. I don't like the idea that the UI should be aware and decide which service implementation to inject. Shouldn't which service impl to use not be the responsibility of the UI?

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

      I personally don’t see the issue with it in this example, QuotesScreen has a source of truth QuotesViewModel which only needs to exist in the context of this view.
      If it needed to be shared across multiple screens, I personally would make it an environment object and inject it into the nessecary views. To go even further I would use a dependency injection library like Resolver or SwiftInject.
      But this is a simple starter video where I don’t really want to overload you, and feel like its a good starting point. In terms of showing you how to implement separation of concerns.
      So in this case it’s fine since the quotes screen has the source of truth, I want to break off my service layer so i can unit test that one component away from the view model which uses it to fetch the data.

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

    17:39 why don't you define and use another APIConstants value for the "/api/quotes" string?

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

      I could do that, but i didn’t wanna go too deep in the video about designing a networking service layer like I said. I just wanted to focus more on project structure/architecture 👍🏾

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

    If the QuoteScreen need 5 API calls and data are not related. How do we implement the ViewModel?

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

      You could use AsyncLet & I cover this in my free Swift Concurrency Course here on YT you can check out below👌🏾
      th-cam.com/video/U6lQustiTGE/w-d-xo.html

  • @Rahul-jf5kf
    @Rahul-jf5kf ปีที่แล้ว

    nice video👍, but one more requirement, If api throws and error either in data or in error how to display it. lets say response is an array of quotes or an error message

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

      Thanks & I have a seperate vid part of another course you can check out that tackles this 🤝
      How To Handle Networking Errors Handling In SwiftUI
      th-cam.com/video/IspTk7bS-Do/w-d-xo.html

    • @Rahul-jf5kf
      @Rahul-jf5kf ปีที่แล้ว +1

      @@tundsdev thank you very much for prompt replay

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

    Excellent

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

      Thank you glad you enjoyed it 👍🏾

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

    cool, really helpful

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

      Thanks glad you enjoyed it 👍🏾

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

    How would I add a button to refresh the list of quotes from the QuoteScreen?

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

      You could add a button into the toolbar and when this is tapped call the function to fetch quotes or if you’re supporting ios15+ you can use the new refreshable modifier to add pull to refresh to the screen and call the function again

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

    Whatz about dependency injection in SwiftUI?

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

    Is the project on Github?

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

      Yep on my github