Parse JSON in App Like a PRO (Xcode 12, Swift 5, 2020) - iOS Development

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024
  • In this video we will learn how to parse JSON from a file directly in our app. We will be working in swift 5 and Xcode 12 as always. JSON parsing is a critical skill needed for any iOS app - one that every developer should master. We will leverage the main bundle and Codable to get this up and running. We will also look at taking the data and presenting it in a clean and organized table view.
    💻 Source Code: / iosacademy
    🎥 Subscribe for more: www.youtube.co...
    😎 Like my teaching style? Check out some of my most popular courses!: courses.iosaca...
    #swift #iOSDeveloper #JSON
    Join this channel to get access to perks, code, groups, and more:
    / @iosacademy
    Join the iOS Academy Community: iosacademy.io/
    ** Get Skillshare free for 2 Months and learn iOS
    www.skillshare...
    ** Manage all your investments from app earnings on Betterment!
    bit.ly/3eBwlI9
    ** Grow your own RUclips tech channel with TubeBuddy:
    www.tubebuddy....

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

  • @94mac
    @94mac 3 года назад +8

    It’s ironic how I was searching an hour ago to parse json in Swift and this video was just uploaded ! Lol nice video

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

    So happy you changed your video style to not zooming in n out all the time. Also great tutorial!

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

      Why? Its people like you that have made it difficult to read now. Whats the issue? Are you on some huge screen or something? When hes coding he should zoom in. The problem is zooming out and in after every word or something. Otherwise zooming is good! I don’t need to see his launch bar, i don’t need to see Xcode or the files on the left.

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

      TheBooban “people like you” relax lol. The zooming and out continuously makes me feel nauseous

  • @Alexander-mg4pr
    @Alexander-mg4pr 3 года назад +2

    Thanks for this video. Very helpful. I can’t wait for the Instagram and TikTok courses coming soon.

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

      Thanks, glad you like the content

  • @30guarino
    @30guarino 3 года назад +1

    Video recommendation ..... DEBUGGING console for "Breaking Constraints" for the UI and how to fix and know where the error is....Thanks for your videos and experience!

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

    Very useful. Thank you!

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

    As always, useful content. Thanks. 👏🏻👏🏻

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

    so easy this example we need complex stuff

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

    Useful video, Thank you.

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

    Hi Everytime my code enter the else part of the guard let path = Bundle.main.path(...) else { print("error") return }

  • @GG-hk5iz
    @GG-hk5iz 3 года назад +1

    Awesome Video ..... Looking forward for SwiftUI Content

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

      Thanks

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

      Not really...barf. Id rather learn flutter.

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

    I looooooove this. I've been trying to find a dictionary of arrays json parsing using a json file. your tutorial is great. when I followed along (using my own data), it kept on repeating my json data multiple times per section. If I had a section called "Fruit" it would list all things under fruit, but it would list them like 10 times and then move on to the next item and repeat that 10 times. any thoughts?

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

    What ever you type code we write but I am not getting output in screen can you tell me.

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

    That’s good sh..stuff!

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

    Great video! Loved it!

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

    Thank you!

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

    Im trying to follow this video with a json file containing some vinyls record but inside the do catch the print statement inside the catch always gets executed.
    How to solve this problem? Where to look for the problem. Here is my code:
    func parseJSON() {
    guard let path = Bundle.main.path(forResource: "teste", ofType: "json") else { return }
    let url = URL(fileURLWithPath: path)
    var vinyl : VinylModel?
    do {
    let jsonData = try Data(contentsOf: url)
    vinyl = try JSONDecoder().decode(VinylModel.self, from: jsonData)
    if let vinyl = vinyl {
    print(vinyl)
    return
    }
    } catch {
    print("ERROR")
    }
    }
    thank u

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

    Hey dude. How about a video teaching how to save the return of the web request in coredata?! Other sugestions is work with Repository. Thank you for your videos. U're awesome.

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

    Love the content. Thank you so much for posting. It's exactly what I was looking for. Liked and subscribed.
    Question. You put parseJSON() directly in the VC. But in an app that follows the MVC model, I would put all that code in its own .swift file under Model, right?

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

    Hello! Can you tell me how to search within the key value pair? And how do you iterate through the Results!

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

    Please do a Video on Alamofire + SwiftyJson.

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

    I want to add 2 columns to my cell, but nothing i am trying is working
    gah!!

  • @Rahul-jf5kf
    @Rahul-jf5kf 2 года назад

    Nice video 👍🏼, How to decode different date formats in same json

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

    great video, how can you decode dynamic json data

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

    Thank you so much for this. The only thing that drives me nuts about your vids is that you seem to have a template or series of templates already installed so it's hard to code along with you. When I open a new SwiftUI, I don't have ViewController, Main.Storyboard, and others. Do you have a tutorial to set our initial screens up like yours so it's easier to follow along?

    • @j.6207
      @j.6207 Год назад

      You have to select "storyboard" as interface when creating a new app project, not "SwiftUI". And make sure to select the language as "Swift" to be able to follow this tutorial.

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

    How to make login (user sign) by mysql?

  • @t.shurid2042
    @t.shurid2042 3 года назад

    When you enter in a function into the view of a swift ui it doesn't work, can this code be used in some way with swift ui? p.s. I like your videos

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

    do you have a download link for that

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

    can ı use it for swiftui too

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

    Thanks for providing amazing tutorials. Could you please do a tutorial on Instagram build api integration with firebase in Swift

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

      Thanks and sure! Added to my list

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

    Hi ,i started learning ios those days , should i learn uikit first or just pass to swiftui ?

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

      Go with UIKit first

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

      @@mellamoraymond why? Its so different from SwiftUi and it unfortunately seems to be the future...barf

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

    I joined the community, but still can't find the code.

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

      Ill add you to the github

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

      @@iOSAcademy looking forward to having access to the code.

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

      @@iOSAcademy I've not received an email that I've been added. Not to pester, but it's been 3 days and I see you're actively posting content here.

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

    Yo, what happened to your microphone? You sound muffled

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

    Don't watch this video, is misleading.. it decodes from a file, not a URL...

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

    You realise you could easily omit the path step by using: Bundle.main.url(forResource: “data”, withExtension: “json”)

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

      Yep, just showing the original way

  • @tinkering.online2007
    @tinkering.online2007 2 года назад

    Hi there, thanks for the great video! I think the first error happened, because you could just leave the curly braces away, to have the json file starting and ending with just [ ] ( www.crockford.com/mckeeman.html )