SwiftUI Tutorial: How to make a API call, fetch JSON, and structure you networking layer with MVVM

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024

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

  • @StephenRouse-tt1pr
    @StephenRouse-tt1pr 3 месяца назад +1

    Thank you, Karin! This was a tremendously useful tutorial, even a couple years later.
    It would be great to see an updated version that uses async/await.

  • @milanfdl1968
    @milanfdl1968 2 года назад +7

    It's amazing how many skills and how many aspects are covered in one tutorial under 1 hour comparing with other ones that show just one thing in more than 1 hour. Well done!

  • @guitaripod
    @guitaripod 3 года назад +15

    Great video. I think you're my favorite Swift teacher. This is the kinda stuff pro-coders wanna watch. It's "for beginners", but it goes so much more in-depth while making sense, than other Swift RUclipsrs. Glad you're making videos. Greatly appreciate the unit test chapters too.

  • @ekadam
    @ekadam 2 года назад

    Thank you, thank you, thank you. I was unable to put a structure to making properly designed project containing API calls. This was a savior.

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

    I like the way you teach. First you're doing it then you are reforming the code. Thanks Karin.

  • @rDivaDuck
    @rDivaDuck 3 года назад +3

    Absolutely the best ios tutorials on youtube, look forward to your next course

  • @mochamadnurkhayalkadafi7570
    @mochamadnurkhayalkadafi7570 3 года назад +2

    All your videos are very helpful, I have never seen a detailed tutorial like yours. Thank you.

  • @stevebarron4095
    @stevebarron4095 3 года назад +2

    Lots of great thinking, here, for architecture, testing, etc. Thank you!

  • @shrinidhishetty6610
    @shrinidhishetty6610 3 года назад +2

    Thank you so much for the detailed explanation. Helped me understand a lot as a beginner in Swift UI.

  • @denizbutandroid
    @denizbutandroid 2 года назад +1

    Informative, clear, quality...
    Positive feedback:
    As an android developer with couple of years of experience, I think this is the most straight-forward video for people like me who is interested in learning how to do things on iOS that you do on Android.
    I loved how it is easy to understand (kind of beginner level) but also cares about industry level stuff such as architecture, testability (using protocols)
    I literally can't wait to discover your other videos.
    Neutral feedback:
    I would like to hear a bit information about iOS specific stuff while you're using them. For example, in a part you say "we should probably use guard let" but I don't know the difference. And I know it's not in the context of this video, that's why I mention this as a neutral feedback and not as a negative one. It would just be more delightful for people like me.
    But overall, great content, Karin. Thank you

  • @berkc5323
    @berkc5323 2 года назад +2

    such an underrated channel!

  • @daixiangli
    @daixiangli 2 года назад

    Great video, exactly what I'm looking for. Step by step instruction of how to build a real world production ready list to detail app, with unit tests. This video doesn't cover basics of Swift and SwiftUI so learn those knowledge before watching this. Really appreciate your effort!

  • @teaberry73
    @teaberry73 7 месяцев назад

    Fantastic tutorial! I learned so much in an hour! Thank you! ❤

  • @ruzev1985
    @ruzev1985 2 года назад

    Best tutorial I've found on youtube, thank you!

  • @MayurPatilishere
    @MayurPatilishere 2 года назад

    This is exactly what I was looking for making a robust networking layer. Thank you so much for this.

  • @user-hr6gh9us4s
    @user-hr6gh9us4s 2 года назад

    Thanks from Japan.
    Your video is very useful to me.
    Thank you very much.
    Sorry, my poor English

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

    So happy I found your channel, most of the channels present simple stuff, that are nice. However once the project grows it gets harder to separate the stuff correctly and most of the videos just leave it ...

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

    Respect! Great video

  • @superus8r
    @superus8r 2 года назад

    Thank you for the great video. It was pretty straight forward and easy to follow.

  • @ShooMPozitiV
    @ShooMPozitiV 3 года назад

    Simple and great explanation! Thank you for your work!
    GO ON!

  • @MrLawaghar
    @MrLawaghar 3 года назад

    Hello Karin! Very easy and super tutorial. Thanks

  • @lusinekhachatryan1019
    @lusinekhachatryan1019 2 года назад

    Thank You!!! Its very Useful video !!!

  • @dispatchswift
    @dispatchswift 2 года назад

    Much appreciated video. Thank you!

  • @AndrewDChristie
    @AndrewDChristie 6 месяцев назад

    Thanks!

  • @user-om1ze4mi7u
    @user-om1ze4mi7u 3 года назад +2

    Thanks for the great Video. I'm a beginner of SwiftUI, I've worked as an iOS Developer for three years. I only develop an application through UIKit. So, I really appreciate your tutorial Videos, because I feel like SwiftUI and UIKit are completely different which makes me confused. I'm not sure that everything from UIKit Project except view layout knowledge can still be applied in SwiftUI or not.

    • @Histats71
      @Histats71 3 года назад

      Hi, I have a question for you. I wonder that professionel ios applications use which technologies? Such as SwiftUI or UIKit, Combine or RxSwift etc. Which one should I improve myself. Thank you :)

    • @user-om1ze4mi7u
      @user-om1ze4mi7u 3 года назад

      @@Histats71 It’s hard to answer, I think It’s about team agreement. But currently I think the most iOS teams still use UIKit to develop applications. But in the future I think SwiftUI definitely will replace it. It’s depends on your life path, which one is more suitable for you.

  • @MauricioChavesDias
    @MauricioChavesDias 3 года назад +1

    Wow, the Error Handling stuff was too much for my beginner brain to function haha

    • @rank1macro
      @rank1macro 2 года назад

      yeah way 2 beginner unfriendly

  • @bobs6473
    @bobs6473 2 года назад +1

    just for an fyi u dont need to have an identifable you could explicitly state forEach what to use as an id

    • @dispatchswift
      @dispatchswift 2 года назад

      True, however having the Breed model conform to the Identifiable protocol leads to a cleaner ForEach call.

  • @vanylaskywalker
    @vanylaskywalker 2 года назад +1

    Should you split the ServiceLayer (NetworkingLayer) from the ModelView? Wouldn't it be more clean to remove the ModelView from networking responsibilities?

    • @dispatchswift
      @dispatchswift 2 года назад

      Yes, the networking layer should be separated from the view model. In this example, the view model is the BreedFetcher class. The view model does not contain the networking logic, it is the APIService class that does.

    • @vanylaskywalker
      @vanylaskywalker 2 года назад +1

      @@dispatchswift You're correct. I made the comment before she refactored the code to split out the networking code from BreedFetcher.

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

    This framework stages makes learning procces a bit frustrating and chaotic, add Storyboard vs ProgramaticUI for it and mix between SwiftUI and UIKit. If you want learn SwiftUI you'll have problems with searching work, if UIKit problems with finding up to date tutorial. I have test from employer, they want ProgramaticUI, UIKit, NetCall, MVVM. Where is possible to find this combination together this days, jisss

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

    Thanks Karin.
    It is actually very useful video for practising.
    However I have a question, my question is; Can you make videos with MVVM design pattern with using UIKit. I am living in Turkey and the industry here is still using UIKit. UIKit is still more important than SwiftUI here. Actually basic logic is the same with SwiftUI but I couldn't find a full app tutorial a lot. And if I find a video about that, It will help my learning process.

  • @nickcostello2810
    @nickcostello2810 2 года назад +1

    At the most basic level, you used unowned when you know the class referenced will not be nil when it's called and weak when it's possible that the class could be deinitialized?

  • @MauricioChavesDias
    @MauricioChavesDias 3 года назад +2

    For me, "case .failure(error)" does not work. It just does not exist error in my code, XCode says there is only the type Error to add in the function .failure. I followed all your code and don't understand what is happening. (26:58 in the video)

    • @MauricioChavesDias
      @MauricioChavesDias 3 года назад +1

      After rewatching the video again, I found out that Karin removed the part where corrects this mistake in the edition of the video. It is just to add the keyword let when pass error in .failure(let error) instead of .failure(error).

    • @rank1macro
      @rank1macro 2 года назад

      @@MauricioChavesDias thanks brother had the same issue

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

    why you need to make generic fetcher and fetcherBreed?

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

    Hi Karin, thank you so much for this tutorial, it is very helpful! I like your approach to make a generic fetch function in the APIService.swift file. However, I don't think you end up calling it. How would you do so? (I'm new to Swift and SwiftUI)
    service.fetch(Breed, url: url) {[unowned self] result in
    DispatchQueue.main.async{
    self.isLoading = false
    switch result{
    case .failure(let error):
    self.errorMessage = error.localizedDescription
    print(error)
    case .success(let breeds):
    self.breeds = breeds
    }
    }
    }
    Will throw the error that it cannot assign a value of 'Breed' to [Breed].
    Thanks!

  • @mahmoudzinji5672
    @mahmoudzinji5672 10 месяцев назад

    Do you have a network layer that you use in your apps and that is testable

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

    I personally think you don't need to put the whole instance of BreedFetcher into an ErrorView and instead just inject the error message string into it

  • @johnbiddulph4389
    @johnbiddulph4389 2 года назад

    I get: Cannot convert value of type 'Artwork.Type' to expected argument type 'Artwork'

  • @johnbiddulph4389
    @johnbiddulph4389 2 года назад

    38:48 I don't have example1() what can I do instead?

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

    despues del minuto 11. me perdi. no entendi nada pero lo vi todo

  • @MauricioChavesDias
    @MauricioChavesDias 3 года назад +2

    Karin, thank you for the video. Although, as a beginner watching your videos here, I have two things to say that for me was quite difficult to follow you:
    1- You go too fast coding and sometimes you miss important things to explain the reasons you are creating that or just a little explanation. (For instance, in the part you create "preview helpers", I did not get the reasons for that.
    2- Please, don't edit the video cutting off important parts of it, such as fixing errors in your code. (For instance, I've had two times problems in my code where you had fixed that without showing in your videos, making me believe I had done something wrong when following you)
    I hope it helps for the next videos and thank you for sharing your knowledge with us!

    • @SwiftyPlace
      @SwiftyPlace  3 года назад +1

      Really sorry, I skipped so much. Sometimes it is hard to make complex tutorials. I will pay more attention next time.
      Concerning your question about the "preview helper." Because I want to see realistic data in the SwiftUI preview, I need to populate some data for these views. When using view models, the data is in the view model. I am preparing example view models that I can use easily in the SwiftUI preview. That are these preview helper functions.

    • @MauricioChavesDias
      @MauricioChavesDias 2 года назад

      @@SwiftyPlace Thanks for the explanation and the understanding, Karin. I wish to reach your level of knowledge one day!

  • @tarkdogdu101
    @tarkdogdu101 2 года назад

    hello can you help me? How should i chance my code if api i use is dictionary ? İ cant figure it out

  • @lewisferreira3261
    @lewisferreira3261 3 года назад

    your channel is great!!awesome!
    Here a fan. like & sub
    could you export this project to xcode 12.0?

  • @Jake-bh1hm
    @Jake-bh1hm 3 года назад

    Hey, I msg you on reddit about a project. Please let me know if you're interested