What is JSON - JSON Parsing in Swift

Sdílet
Vložit
  • čas přidán 27. 08. 2024

Komentáře • 224

  • @MediArgentum
    @MediArgentum Před rokem +1

    I am literally watching this video while on a bus, heading to the company that contracted me to update their app and implement a functionality that requires exactly what's explained here. Talk about winging it lmao. Thanks Chris 👍

  • @gauntletwielder6306
    @gauntletwielder6306 Před 4 lety +1

    I had to come back and watch this again. Why? Because people who watched this came to me for help.
    *This is a great instructional video* However, it is only one side of the same coin.
    The other side of the coin... doing something practical with the JSON data outside the scope of the completion handler. Maybe presenting the data in a tableView and *not* on a background thread. And having that data available when a user selects a tableViewCell.
    So many people have come to me because they do not know how to continue where this video leaves off.
    People are looking forward to seeing Part 2 of this. Thank you.

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, maybe this other video will help on how to present JSON data czcams.com/video/Yzx7ihtCGBs/video.html
      - Francis

    • @gauntletwielder6306
      @gauntletwielder6306 Před 4 lety +2

      CodeWithChris - Thank you Francis. However, that specific video mostly describes what an API is. Great for anyone wanting only to know what an API is.
      Unfortunately, that video *is not* the equivalent to a Part 2 of this video. This video needs a genuine follow up to show how to retain and use the collected JSON data *outside the scope of the completion handler* Getting the data is half the objective, processing and presenting it, is the remaining half. How many apps in the App Store use print(“...”) to display data to the user? Hint: the answer rhymes with Nero.
      A genuine Part 2 to this video, would be welcomed by many people.

    • @toqix6861
      @toqix6861 Před 4 lety +1

      That‘s exactly what I would need

  • @Viral_Meme3499
    @Viral_Meme3499 Před 3 lety +2

    Thank you chris I am learning lot from your tutorials. ❤️Love from India🇮🇳

    • @CodeWithChris
      @CodeWithChris  Před 3 lety +2

      Namaste! Much love to you as well! Keep on going! -Arthur

  • @Jeppelelle
    @Jeppelelle Před 4 lety +1

    I had to parse JSON a couple of Swift versions ago and it was such a PAIN to parse JSON back then, so happy that the Apple developers improved this, so much easier nowadays 👍

  • @spearlightknight1714
    @spearlightknight1714 Před 2 lety +1

    Hello Chris, thank you for this video. I am no non programmer and this video helped to explain what JSON is so at least I can understand what my dev team says.

    • @CodeWithChris
      @CodeWithChris  Před 2 lety +1

      This comment made our day. Keep on going! :) -Arthur

  • @pistonsky
    @pistonsky Před 2 lety

    Wow, that was really quick! Definitely better than dealing with JSONSerialization.

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      Spasiba! Thanks for learning with us! -Arthur

  • @sujitmolleti2322
    @sujitmolleti2322 Před 4 lety +2

    Thank you so much, Chris! This tutorial was very well-paced and gave me the proper context of what was happening. Excited to see what you make next!

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Happy to help, thanks for being a supporter for 7 months+ too!
      PS: We are working and planning on so much good stuff for the rest of the year! Uuuuuuuuuh
      @AdrienVillez

  • @superintegrated9994
    @superintegrated9994 Před 3 lety

    you are great man! really great. Because you make your videos touching all required points, topics, subjects while developing the target code, not just copy pasting the code.

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      Thank you so, so much for your kindness! We appreciate you! Gives us more motivation to keep on hustling. All the best to your projects! -Arthur

  • @rohitoznikam3735
    @rohitoznikam3735 Před 4 lety +7

    Thank you Chris ! It helped me in learning.

  • @AtesotFlavor
    @AtesotFlavor Před 2 lety

    I could sure use your help setting up this dispatch API.

    • @CodeWithChris
      @CodeWithChris  Před 2 lety +1

      Hi, kindly post your question in our CodeCrew forum so that our tech support staff can assist you. Go here: codecrew.codewithchris.com. Thanks for learning with us! -Arthur

  • @alifarhadi5704
    @alifarhadi5704 Před 4 lety +2

    Hey Chris thanks a lot for making these great videos, you teach stuff very well and also you say some valuable experience while you teaching such as put some breakpoint or use debug console and also make properties optional. Thanks a lot again

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Thanks for the feedback! We really appreciate this. 😊
      -Kat

  • @davetisdale8628
    @davetisdale8628 Před 3 lety

    Thanks Chris! You are a great instructor!

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      And you are a great student, Dave! Appreciate you! -Arthur

  • @richardwalters9249
    @richardwalters9249 Před 4 lety +1

    Excellent video ... thanks for sharing this ... learning a lot

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Great to hear! Thanks for watching this.
      - Kat

  • @JusCJay
    @JusCJay Před 4 lety +2

    Reddit API or CZcams API. Great tutorial!

  • @easthastings6919
    @easthastings6919 Před 2 lety

    you are a wonderful specimen

  • @shd2236
    @shd2236 Před 4 lety +4

    A Shopify API would be amazing. Maybe a way to fetch products or something like that

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Added it to the list, thanks for suggesting!
      -Kat

  • @charlesokehie6940
    @charlesokehie6940 Před 4 lety +3

    Great video, very insightful thank you! Is there anyway , you could do a series on this to go into more detail? I get the general gist but not sure I would be able to replicate on my own. A tutorial in the context of an app that displays the parsed information would be very helpful. Also have you mentioned things like "do catch try" in other videos? This was my first time hearing it and was a bit confusing.

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, maybe this blog we made can help you better understand error catching codewithchris.com/swift-try-catch/
      - Francis

  • @benjamincleek7815
    @benjamincleek7815 Před 2 lety

    I know I'm late, but would love to see a demo of google earth and/or maps API!

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      Hello, Benjamin, can you kindly post your suggestion here: app.productstash.io/codewithchris#/ideas Thanks for learning with us! -Arthur

  • @adilal-marzooq1582
    @adilal-marzooq1582 Před 4 lety +2

    Very nice. I would like to see an email validator API

    • @adrienvillez
      @adrienvillez Před 4 lety +1

      I can't post a link here because CZcams is gonna flag my comment, but Google "email validation Swift Github" and you'll find some pretty great things!

    • @adilal-marzooq1582
      @adilal-marzooq1582 Před 4 lety

      Adrien Villez thanks 👍🏻

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Thanks. 👀👍
      -Kat

  • @andrejkling3886
    @andrejkling3886 Před 3 lety

    Good tutorial Chris, we will wait for SwiftUi as the same... your solution. Thank you

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      Cheers, Andrej! Glad to know that you are happily learning with us. :-) -Arthur

  • @dronesim
    @dronesim Před 3 lety +2

    Spotify API would be amazing. Better yet, parsing the data and showing it in the front end

    • @CodeWithChris
      @CodeWithChris  Před 3 lety +1

      Cheers, thanks for suggesting that! :-) -Arthur

  • @EngineeringWithEugene
    @EngineeringWithEugene Před 4 lety +1

    Great content Chris and co!! Would love to see a Facebook API in action. Looking to grab a pages info to keep up to date on that companies events (gatherings) in my application.

  • @adamhowley8037
    @adamhowley8037 Před 4 lety

    I know it isn't the focus of the video but what is the best way to manage API keys in Xcode?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, that depends maybe you can put it in UserDefaults for quick saving and access
      - Francis

  • @TylerWasick
    @TylerWasick Před 4 lety +1

    So why are you choosing to use Swift Storyboards for this demo vs SwiftUI? Is there a difference for how this is done? Thanks!

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, there shouldn't be too much difference in codes when parsing the json, the main difference would be how to create the user interface, for now the storyboard is still the one prominently used because swiftui can only be used by ios 13 and above
      - Francis

  • @glennadams7047
    @glennadams7047 Před 4 lety +1

    Nice tutorial. Thanks!

  • @miisolucky1879
    @miisolucky1879 Před 3 lety +1

    @CodeWIthChris is there a way to edit the information on a JSON extracted file and feed it back to the orginator?

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      "Hello, usually that would be considered as an API interaction, or maybe database.. most of the time the data is sent as JSON but you update by batch using the API
      - Francis"

  • @toanuk
    @toanuk Před 4 lety +1

    Hi Christ.
    It is good and easier to understand parsing Jason to Swift not swiftUI,
    I am glad to to understand the basic.
    How to creat a json file
    Menu
    I'd, name, cost, description
    as you API..
    Thanks

  • @ishowyouapple
    @ishowyouapple Před 4 lety +1

    Now that it’s done, what do you with that after your parse it?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, depends on you, usually after parsing you just print/present the data to the UI, or maybe do some computations with it, its all up to what your app needs
      - Francis

    • @SauravKumar-si6yg
      @SauravKumar-si6yg Před 4 lety

      @@CodeWithChris Hey Francis, how exactly can we work with the data, such as making a list of the news articles like the ios news app? Do you have any blog posts or videos on that?

  • @oshinvats7304
    @oshinvats7304 Před 4 lety +2

    Hi, I know this is quite late, from when this video came out, but I was wondering where do we put the session request and everything. Chris said that we shouldn't put it in the viewcontroller. Where do we put it?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, i suggest putting the request in ViewWillAppear(), or a button (or asyncronous function) that will have a chance to trigger a "refresh" in your collection. and will thus update data
      - Francis

  • @michaelpowers7164
    @michaelpowers7164 Před 4 lety +1

    How would you go about parsing date ranges? For example, the data goes back to 1914, but I only want to extract data from 2020. What woud be the best way to do it?
    example-
    To filter the dataset to only return records containing a specified value for incident_datetime simply add a URL parameter to your URL with incident_datetime as the key and your specified value.

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, as long as the records are in the same format then it then be fine, you might need to ""recalculate"" or cast your date records into Date format so it will be easier to handle, i suggest searching around on google there are plenty of articles that cover ordering/filtering by date
      - Francis

  • @SauravKumar-si6yg
    @SauravKumar-si6yg Před 4 lety +2

    Hey Chris! What do I do if I am working with a api that has a dictionary inside a dictionary, inside an array, etc. I know we can use the structure code, but how do we do this if it is all nested?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, depends on your structure, so if you have an array inside an array its somthing like a[0][0].. or if theres a dictionary inside the array then maybe a[0]["name"], or something similar, it depends on which one is first and you just add the additional step to be able to access it
      - Francis

    • @SauravKumar-si6yg
      @SauravKumar-si6yg Před 4 lety +1

      @@CodeWithChris thanks for the reply, that worked!

  • @DrMemory99
    @DrMemory99 Před 4 lety +1

    Very Nice. I was very frustrated first time I tried to use this API in a headlines app tutorial as several of the data values would come up nil. This explanation and data modeling was much clearer to me. Thank You. Im using Xcode 11.3.1 and don't get the nice human readable JSON format in the terminal at the print(newsFeed) statement. Also I get an error at that breakpoint when trying to 'po newsFeed' ; that I'm assuming is related to my older Xcode. Thanks Again. I learn something new with each of your video postings.

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Thanks for watching it! Glad to know you're learning with our tutorials.
      -Kat

  • @natgenesis5038
    @natgenesis5038 Před 2 lety

    I always love and follow your tutorials ;what is the best networking for a beginner to learn as an iOS dev ???? thanks for this video.

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      Hello, kindly post your question on our CodeCrew forum so that our tech support can give you insights about this. Go here: codecrew.codewithchris.com. Thank you! -Arthur

  • @michaelpowers7164
    @michaelpowers7164 Před 4 lety +2

    Hey guys, everything in this code works except the very last line. I get this error code in regards to the follopwing. Are there any suggestions?
    error- "Variable used within its own initial value"
    This is the line of code that recieves the error "dataTask.resume() "

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, check your ""resume()"" function, it seems that you might be settting a constant value to itself(or same named parameter) so change the parameter name to avoid the error
      - Francis

  • @guruitcompany
    @guruitcompany Před 4 lety +1

    Great video! Thank you.

  • @se7enzz258
    @se7enzz258 Před 4 lety +1

    Great video. Thanks!

  • @MyDataScienceTutor
    @MyDataScienceTutor Před 4 lety +2

    I just tried to run this and I'm getting an error because the site is not secure. Says "App Transport Security has blocked a cleartext HTTP () resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file." I have no idea how to tweak the Info.plist file to accommodate this. Can anyone help?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, you can try to add an "allows arbitrary loads" in your info.plist, or you can simply try to load your resource using "https" instead of just "http" apple is pretty strict about this
      - Francis

  • @stuartthompson1943
    @stuartthompson1943 Před 4 lety +1

    A few people have asked this perhaps you know what to do? The problem is: THEN what? I have data in a URLSession response but that's asynchronous, so my app has moved on and my data is sitting somewhere I can't access. I have a bunch of data but how do I get it back to the parent? (In Javascript I'd nest the function or use await, for example.)

    • @stuartthompson1943
      @stuartthompson1943 Před 4 lety

      This answered it for me. I was doing a web API call. czcams.com/video/tdxKIPpPDAI/video.html

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, you can try to make an external swift file, lets say ""globalData.swift"" and declare the variables you want to use there, you can then set the values of the variables and you will be able to access those anyway in your app
      - Francis

  • @toqix6861
    @toqix6861 Před 4 lety +2

    Hey, The JSON parsing in my project works perfectly fine, but i have problems passing the data to my View in SwiftUI. I tried to use an observableobject, but I‘ve got problems with the initialisation. Because my variable of the type NewsFeed object has no data in it when declared.

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, maybe there was a mismatch somewhere that made your NewsFeed object null, you can try going to our forum at codecrew.codewithchris.com so we can take a better look at your problem
      - Francis

  • @tharlinhtet97
    @tharlinhtet97 Před 4 lety +1

    Nice video sir, keep going.

  • @ghuener
    @ghuener Před 4 lety

    Chris, I was able to complete the project in this video successfully, but i get. nw_socket_handle_socket_event [C1.1:2] Socket SO_ERROR [61: Connection refused]
    when I hit a localhost api that returns a json result. Is there something special about making a request of a localhost as opposed to the news site in your video? I realize this is a super specific question, but I've exhausted my other resources. Very new to this...

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, maybe you might need a special permission to be able to access localhost, or your localhost itself is not configured properly to accept connections.
      check the permissions along with your localhost to see the problem
      - Francis

  • @rolandparnaso4612
    @rolandparnaso4612 Před 4 lety +1

    This is outside of this video, but if I hit `JOIN` will I still see ads or not? And how can I see your videos without ads (without premium CZcams)?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hey Roland, right now, it doesn't remove ads but this is a good suggestion for the CZcams membership.. i might upload the CZcams videos on my course platform and make it available ad free for people in the YT membership.

  • @allurisirisha3940
    @allurisirisha3940 Před rokem

    Hey how to get this news API for my practice? can you please mention it in description box.

  • @TheDba6060
    @TheDba6060 Před 3 lety

    Thank you chris !

  • @user-rc2nt1tb2u
    @user-rc2nt1tb2u Před 4 lety +1

    .
    I'm trying to build an app that searches through the web (Using web scraping) and returns the specified data instantly (data can be updated on the website and I want it to be updated in my app as well), can that be done with JSON?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, yes usually JSON is the best way to share data between apps/websites/and a server
      check out our swiftyjson to handle json data codewithchris.com/swiftyjson/
      - Francis

  • @adammarez2684
    @adammarez2684 Před 4 lety +1

    I love this dude!

  • @ammarahsrahman18
    @ammarahsrahman18 Před 4 lety +1

    Please upload more videos on this, also with http header

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Yes, there will be more videos like this! :)
      -Kat

  • @avneetsingh2010
    @avneetsingh2010 Před 3 lety

    Thank you Chris... Your videos are really amazing... Please make a video on NMSSH or other framework that supports SSH remote connection... Any links to such libraries or tutorial would be highly appreciated :-)

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      Thanks for the support and suggestion! :-) -Arthur

  • @astonmartin3309
    @astonmartin3309 Před 2 lety

    Thank you! That helped!

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      Anytime. Thanks for learning with us! :) -Arthur

  • @TCakes
    @TCakes Před 2 lety

    Stupid question, but what do we do if the json starts out as an array? For instance the reddit api for comments begins with something like 1.data.children[0].replies.body
    I understand how to decode everything but the array (or dictionary?) in the beginning... I try decoding it as [ObjectThatContainsData] and that doesn't work either. On stack I've seen people mention ways to work with this using serialization, but as far as I know it's always better to use decoding right?

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      Hello, kindly post your question in our CodeCrew forum so that our technical support staff there can assist you. Go here: codecrew.codewithchris.com. Thanks for learning with us! -Arthur

  • @jeffrosengarden6935
    @jeffrosengarden6935 Před 4 lety

    After watching the video (numerous times) I built an Xcode project to mimic what you did in the video. I got it all working and then made a change were retrieving the JSON feed is being handled in a method within ViewController.swift. So now the only additional line in the viewDidLoad() method is this: getJSONFeed(). The method (getJSONFeed) is working fine and I'm able to put in a break and make sure that I did, indeed, retrieve the JSON data feed but I'm having trouble trying to figure out HOW to pass that data back from the method getJSONFeed() to viewDidLoad().
    I think I have two problems that I need help with:
    1. I have created a class property as an optional NewsFeed type: var thisNewsFeed:NewsFeed?
    I'm not sure if this is correct.
    2. I am then trying to set this variable within the getJSONFeed() method by adding self.thisNewsFeed = newsFeed. I then placed a print(self.thisNewsFeed) in the code and it properly displays the JSON data that was retrieved. However when trying to access the thisNewsFeed back in viewDidLoad(), after the call to getJSONFeed() it's NIL. I think my problem is this: how to pass data from a closure.
    here is the ViewController.swift code:
    import UIKit
    class ViewController: UIViewController {
    // Class properties
    var thisNewsFeed:NewsFeed?
    override func viewDidLoad() {
    super.viewDidLoad()
    getJsonFeed()
    // peek at value of class property after the call to getJsonFeed()
    if thisNewsFeed != nil {
    print(thisNewsFeed!)
    }
    }
    func getJsonFeed() {
    // Hit the API endpoint
    let urlString = "newsapi.org/v2/everything?q=bitcoin&from=2020-02-12&sortBy=publishedAt&apiKey=hiding_my_api_key_for_this_posting"
    let url = URL(string: urlString)
    let session = URLSession.shared
    let dataTask = session.dataTask(with: url!){ ( data, response, error) in
    // check for errors
    if error == nil && data != nil {
    do {
    // Parse JSON
    let decoder = JSONDecoder()
    let newsFeed = try decoder.decode(NewsFeed.self, from: data!)
    // now set the class property thisNewsFeed
    self.thisNewsFeed = newsFeed
    // and display it to insure it actually contains the JSON data
    print(self.thisNewsFeed!)
    }
    catch {
    print("error in JSON Parsing")
    }
    }
    }
    // Make the API Call
    dataTask.resume()
    }
    }
    Any help would be appreciated!!!

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, i suggest moving this problem to our public forum at codecrew.codewithchris.com so we can take a better look at your project
      - Francis

  • @JustinSletcherMusic
    @JustinSletcherMusic Před 4 lety +1

    I'm working with a JSON that just gives me number as headings. I can't create constants or variables as numbers in swift so what would the solution be? It's just a practice project, I've managed to get other APIs working, but I've come across a few like that, so I'm hoping for an easy solution
    Thanks

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, it should be possible to use number as headings, may i suggest to use swiftyjson to parse your data? we have an article for it here codewithchris.com/swiftyjson/
      - Francis

  • @noelsoderstrom8706
    @noelsoderstrom8706 Před 3 lety

    Hi Chris! When printing the newsFeed it just says newsFeed() in the console. Do you know what the problem could be and why it doesnt print the contents of stockData?

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      "Hello, i think you printed the class instead, maybe it was decoded wrong,, try checking your variables it needs to be exactly the same (uppercase and lowercase)
      - Francis"

  • @siento3239
    @siento3239 Před 3 lety

    hello chris i got this error "nw_protocol_get_quic_image_block_invoke dlopen libquic failed" and the parsing got thrown . Do you know any solution? im on xcode 12.4

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      "Hello, this seems to be a common simulator issue recently, try changing to a different device
      - Francis"

  • @MissaMelodica
    @MissaMelodica Před 4 lety

    Hi Chris,
    If I wanted my JSON to have elements that are underlined or italicized and then save it as a NSAttributedText... how would I do that?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, maybe save the attributes on a different "column", so for a blogpost you have the "text/body", and the "style" which is the values for the NSAttributes
      - Francis

    • @MissaMelodica
      @MissaMelodica Před 4 lety

      @@CodeWithChris Thanks. I went with an HTML parser instead.

  • @NuWhite
    @NuWhite Před 3 lety

    Thank you so much!

  • @salehal-shammari3510
    @salehal-shammari3510 Před 4 lety +2

    Hi, thank you very much what a great Video..
    I have a question : how to declare a dictionary in the Newsfeed.swift File, I'm trying but its not working with me ! please help me

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, this video should help you learn about dictionaries, dont worry they will work the same
      - Francis

  • @aviadsabag8193
    @aviadsabag8193 Před 4 lety +1

    Hi Chris, first of all thanks for the videos bru!, second, i'm what are the skills needed as a junior developer to have? i mean i would like to apply for a job but aint sure about if i got enough projects and if they are big enough

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      We released a video about that, watch this: czcams.com/video/x9tv-bDQi5Q/video.html :)
      - Kat

  • @alexwarrener3770
    @alexwarrener3770 Před 4 lety +1

    Okay so how would we then present that data in the storyboard? I've searched it up and I cant find how to actually use the data?!

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, you can use it as the source data for a tableview/colletionview for example
      - Francis

  • @pradeep8infosys
    @pradeep8infosys Před 3 lety

    Hi Chris... Good Evening. This is Pradeep from India. Honestly, I have acquired most of my Swift knowledge from your tutorials. This Video is excellent and has given a lot of insights on how to use URLSession and Codable Protocol to fetch the data and parse it. Thanks a lot. On the same note, Can you suggest on what is the best way to have a Network Manager that does this job? I don't want to write the same code in every controller and want a single place where i can fetch and parse my data that returns back to my controller? Can you please point me to any of your videos that does this?

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      Hello, maybe you can use the full stack notes app czcams.com/play/PLMRqhzcHGw1YSKIO61XncxTPoFu81K1Mx.html
      or CoreData tutorial czcams.com/play/PLMRqhzcHGw1aDYKmCuqXQ_IqpWpJlpoJ3.html
      - Francis

    • @pradeep8infosys
      @pradeep8infosys Před 3 lety

      @@CodeWithChris Thanks a lot.. Will check out all those 4 videos in the suggested Playlist..

  • @PeteTheGolfer1
    @PeteTheGolfer1 Před 3 lety

    I wrote an app that stores JSON data into UserDefaults. I wanted to add a new property to the struct. When I ran the app, the decode failed. I assume it was because I attempted to read a property that wasn't defined in the JSON. Is there an easy way to get around this? Is there a specific error code I can check for?

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      "Hello, i don't think you can store JSON property in UserDefaults, you can probably save it as converted value (the class you made) instead, or save a local copy of the JSON file to your directory instead
      - Francis"

  • @withd5943
    @withd5943 Před 2 lety

    Hey Chris, awesome video! I was wondering if you would consider parsing JSON with Text & Image into a TableView. If yes, waiting for the tutorial 🙏

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      Hello, kindly post your question in our CodeCrew forum so that our tech support staff can assist you. Go here: codecrew.codewithchris.com. Thank you! -Arthur

  • @the_meaning_of_love
    @the_meaning_of_love Před rokem

    Love it 💚

  • @zachariahball6464
    @zachariahball6464 Před 4 lety

    Hi Chris!
    Fantastic video, very clear and I managed to adapt it to my OpenWeather API I'm using.
    Is there any chance you're doing a follow up video about how to use this data to change labels and text inside of storyboard?
    Aim for me is to make a basic weather app as a project, but having serious trouble as to how to use this data.
    Thanks again for the video!

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, maybe you can check out our SwiftyJSON so you can see how easy it is to use the data you have read from the apis codewithchris.com/swiftyjson/
      - Francis

  • @nileshjdarji
    @nileshjdarji Před 2 lety

    do you have an example that shows how to create the json object with dictionary datatype.

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      "Hello, try checking out results from like itunes API or something it should be similar
      - Francis"

  • @davidleda2324
    @davidleda2324 Před 3 lety +1

    Hi Francis! Hi Chris!
    It would be great if you could make a tutorial explaining how to display JSON data in SwiftUI.
    There's already several tutorials out there explaining this but they all use the List container to display the data. But Lists require your struct to be Identifiable, otherwise it won't work:
    ```
    struct Todo: Codable, Identifiable {
    public var id: Int
    public var title: String
    public var completed: Bool
    }
    ```
    In this example the response object from the API has and "id" key. But what if it didn't have one? Then you cannot make it Identifiable, and therefore you cannot pass the data to a List container.
    Therefore, my question is: how do you display JSON data in Content View without using the List container?
    Thank you!

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      Hello, maybe using swiftyJSON is the right tool for you. check out our article about it codewithchris.com/swiftyjson/.
      the usage should be similar even when on SwiftUI
      - Francis

  • @bakdauletm5080
    @bakdauletm5080 Před 4 lety +1

    Hey Chris, I wanted to find a job as IOS developer this year and I wonder should I actually learn UIKit or not?
    What you think about it?

    • @mikaelacaron4694
      @mikaelacaron4694 Před 4 lety +3

      Yes!! ALL production apps by companies will be UIKit, no one other than indies are using SwiftUI because it's brand new

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Yup, Mikaela is right. If you intend to get an iOS development job, knowing how to use UIKit is still a requirement for most companies.
      -Kat

  • @markme7092
    @markme7092 Před 4 lety +1

    Please make video for adding image in core data

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Thanks for the suggestion! Check this out www.vadimbulavin.com/how-to-save-images-and-videos-to-core-data-efficiently/
      -Kat

  • @punkysuen
    @punkysuen Před 4 lety +1

    Can I put struct of Article directly inside the NewsFeed.swift?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hi Kin! We are limited in the comment section to talk code and share screenshots, please jump over to our CodeCrew Support Group: bit.ly/CodeCrewCommunity so we can help you the best as we can!
      - Kat

  • @chadvader93
    @chadvader93 Před 4 lety

    can you show how to implement basic user/password authentication against an API? I got an API that does not require an API key but the credentials of my user on the platform

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, most apps probably also has user and password functions but it may also return an API key that you can use instead for fast log-in, think of it as a UserID (primary key) of some sorts. i think its as simple as using network connections if its an API
      you can try our alamofire tutorial maybe it can help codewithchris.com/alamofire/
      check out swiftyjson as well codewithchris.com/swiftyjson/
      - Francis

    • @chadvader93
      @chadvader93 Před 4 lety

      CodeWithChris I could solve it now on my own by using the HTTP Header attribute „authorization“

  • @gauntletwielder6306
    @gauntletwielder6306 Před 4 lety +2

    Nice video. The Facebook API would be nice. Thanks. 👍🏻😀
    I have to admit, I have my own selfish motivation for that suggestion. Lol. There are billions of active FB users who use the wealth of features and services offered by FB. However, there is a glaring omission in the world of FB. It is a feature I have wanted for years... I cannot be the only one who wants it. Lol. Oh yeah... FB no longer supports their own Objective-C SDK. Thank you FB. Now I have to venture into Swift.
    I almost forgot... the feature I want to implement, uses a new dynamic approach to security by retrieving bare minimal information... only when it is needed. The code I have in mind will *NOT enumerate* through all friends and collect their info. *Bare minimum info only when needed.* I want to make and sell an app that works as advertised, not take advantage of people after they buy the app.

  • @Ivan_Maslov
    @Ivan_Maslov Před 4 lety +1

    I would like to see Vk API. How to transform time(duration) into readable format(00:00 or 00:00:00), representing time unit

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Thanks for the suggestion! I'll add it to the list.
      -Kat

    • @Ivan_Maslov
      @Ivan_Maslov Před 4 lety

      CodeWithChris, I have figured out how to do that with DateComponentsFormatter.

  • @jamesqiu6715
    @jamesqiu6715 Před 2 lety

    @20:50 who teaches you to force unwrapped that "data" on line #38 ???

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      Hello, best if you talk to our tech support staff about this: codecrew.codewithchris.com. Thank you, James! -Arthur

    • @jamesqiu6715
      @jamesqiu6715 Před 2 lety

      @@CodeWithChris What I meant was that "data!" should be replaced as
      guard let validata = data else { fatalError () }
      even without any teaching / support staff help !

  • @jovictor3007
    @jovictor3007 Před 3 lety

    Great Video, you below part of xcode seems different from mine, how did you get to get lldb po ? why didnt print happen automatically since you had print newsfeed already in the code ?

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      "Hello, ""lldb po"" is just a header that signifies that the data you see is coming from the debug log, so its not from the normal print log
      - Francis"

  • @Ipadstands
    @Ipadstands Před 2 lety

    Thanks !

  • @amitrai6471
    @amitrai6471 Před 4 lety +1

    Hey Chris make a video on OAuth Api

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      It's already added on our list, don't worry! We just have a very long list of topics to cover. 😄
      -Kat

  • @jeffrosengarden6935
    @jeffrosengarden6935 Před 4 lety +1

    Chris: Any chance of getting a copy of this Xcode project to play around with? Thanks! (Great video by the way!!!!)

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Thank you! Unfortunately, we don't have the source code available for this project.
      -Kat

  • @neilbhosle2841
    @neilbhosle2841 Před 3 lety

    Can you make a video on parsing data by json serialisation

  • @tharlinhtet97
    @tharlinhtet97 Před 4 lety

    sir, i met with ATS block. what's wrong with me

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, I'm not really sure what you mean, i suggest posting your error on our forum at codecrew.codewithchris.com so we can take a better look at your problem
      - Francis

  • @Kunume_
    @Kunume_ Před 4 lety

    Wonderful video! But I keep getting this error: "typeMismatch(Swift.Dictionary, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Dictionary but found an array instead.", underlyingError: nil))" and i'm not sure what to do. If you had any advice that'd be awesome, thank you.

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, it seems you used an array which is not a "key-value" pair. you can check out this video for reference
      czcams.com/video/mJwmGpdZQAg/video.html
      - Francis

  • @user-ec1dn3uz5k
    @user-ec1dn3uz5k Před 3 lety

    Thanks a lot Chris! This means a lot. I messaged you on Twitter haven’t heard back 😃

    • @CodeWithChris
      @CodeWithChris  Před 3 lety +1

      What is it? Hope we have already responded to it by now. If it's a technical question, post it here: codecrew.codewithchris.com. Enjoy! -Arthur

    • @user-ec1dn3uz5k
      @user-ec1dn3uz5k Před 3 lety

      @@CodeWithChris my question was if you have any tuts or paid courses that goes in details on UI testing, and Unit testing for UIKit ? It's so hard scavenging the web for these two topics, not enough in-depth resources. If you have any resource that can help a beginner get competent in unit or UI testing please share it with me

  • @EveyEverlasting
    @EveyEverlasting Před 3 lety

    what about a local JSON fil thats part of your project?

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      "Hello, yes its totally fine to have a local JSON file just set the URL to be a file with path so it gets it from the local files
      You can also check out our SwiftyJSON tutorial codewithchris.com/swiftyjson/
      - Francis"

  • @babarrauf7857
    @babarrauf7857 Před 3 lety

    Sir? Is there anyvideo regarding accessing json data in a zip file and then using that data to map our UI?

    • @CodeWithChris
      @CodeWithChris  Před 3 lety +1

      "Hello, i don't think its possible to directly exact the data from a ZIP file, you will need to have the data (extracted) in the proper directory so the app can access it
      if you are also interested in utilizing JSON try out our swiftyJSON tutorial maybe it can help codewithchris.com/swiftyjson/
      - Francis"

    • @babarrauf7857
      @babarrauf7857 Před 3 lety

      @@CodeWithChris thank you very much sir, i hope your channel grows to be one of the best ❤️

  • @mookastudio
    @mookastudio Před 2 lety

    Thanks

  • @MrJamesieBoye
    @MrJamesieBoye Před 3 lety

    Great tutorial, really enjoying it...
    however I am getting this error... i can see many people on forums getting this error after upgrading to Xcode 12, im not sure if that is the reason, yet this is the error I am getting after running your example, what does this mean?
    JSON[30212:2685228] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
    Error in JSON parsing

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      "Hello, try changing your simulator i think some people find that it works by doing this.. or ifs really the JSON thats the problem when try checking your spelling it needs to be exactly the same (includding capitalization) when you parse JSON
      - Francis"

    • @Hesham.Sultan
      @Hesham.Sultan Před 3 lety

      I fixed it by using square brackets on newsfeed --> [newsfeed].self instead of newsfeed.self . I hope this helps

  • @michaelangelos5117
    @michaelangelos5117 Před 4 lety +1

    Cool.
    Thx

  • @dannydenovi29
    @dannydenovi29 Před 4 lety

    Hi Chris! How can I send a request or change a value in the JSON file with an action in my App?

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, you might need to write to the file (make sure to add permissions) and you can either overwrite the entire file (to edit it), or append if you just want to add records
      - Francis

    • @dannydenovi29
      @dannydenovi29 Před 4 lety

      CodeWithChris Thank you so much!

  • @volimpia
    @volimpia Před 4 lety +1

    Nice video. You said usually it is not hard coded like let urlString = ".......". Will you be making a video about the other way? I tried to use an api from rapidapi.com/ , but I could not find a json example there to create a struct base on that. Can you maybe use an api from there for next lesson and show how to do that? Thank you!

    • @CodeWithChris
      @CodeWithChris  Před 4 lety +1

      Hello, we used newsAPI for this lesson. you just need to look for documentation on rapidAPI on how they make their JSON data and how to call it
      - Francis

  • @haroonmazhar5212
    @haroonmazhar5212 Před 4 lety +1

    good

  • @nikolqy
    @nikolqy Před 3 lety

    Would it kill you to put the code on github?

    • @CodeWithChris
      @CodeWithChris  Před 3 lety +1

      "Hello, this project is just for conceptualization and to explain how to handle JSON, for most of our newer and other projects it will be available to access in our GitHub page so you should check them out there instead
      - Francis"

    • @nikolqy
      @nikolqy Před 3 lety

      @@CodeWithChris kk thx. Sorry, I was a little upset because I get really easily distracted and my speakers were acting weird for some reason -so it was nearly impossible to follow and I just wanted a quick copy/paste 😂

  • @dineshkhatri3859
    @dineshkhatri3859 Před 2 lety +1

    dictionary inside array [{},{},{},]

    • @CodeWithChris
      @CodeWithChris  Před 2 lety +1

      You don't need the final comma, ;)
      @AdrienVillez

  • @abhisheksagar5289
    @abhisheksagar5289 Před 3 lety

    can you make video on sunshine conversation api for facebook integration.

    • @CodeWithChris
      @CodeWithChris  Před 3 lety

      Thanks for your suggestion! Can you kindly post your suggestion here: app.productstash.io/codewithchris#/ideas :-) -Arthur

  • @bhawnasolanki8351
    @bhawnasolanki8351 Před 2 lety

    hello sir can you make project on moya

    • @CodeWithChris
      @CodeWithChris  Před 2 lety

      "Hello, sadly our channel only focuses on iOS content. Thank you for showing in the channel though, much appreciated
      - Francis"

  • @jayeshpateltelearglass

    API for iOS app please🙏

  • @dmitry3881
    @dmitry3881 Před 4 lety

    Parsing in the view controller at work and take off on the same day. 100213031291390231092329 video how to parse. 0 video how to do it in a separate layer

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, im not sure if i quite understand your question. i suggest moving to codecrew.codewithchris.com so we can take a better look at your problem and also have the opinions of other developers in the forum
      - Francis

    • @dmitry3881
      @dmitry3881 Před 4 lety +1

      ​@@CodeWithChris ,I don't know much English (. I mean, parsing in a view controller is a bad practice. You need to do this in a separate “net-woking” class, but no one tells how to do it

  • @jianqinzhao6617
    @jianqinzhao6617 Před 4 lety +1

    Facebook API please

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello! Thanks for the suggestion, it's in our future topics list. :)
      - Kat

  • @davidwim
    @davidwim Před 4 lety +1

    Can you please do a tutorial of using an API from one of those scooter/bike companies and displaying it on a map as I can't figure out how to implement it. Here's the GitHub page for the API I'm trying the intergrate: github.com/ubahnverleih/WoBike/blob/master/Lime.md Thanks!

    • @CodeWithChris
      @CodeWithChris  Před 4 lety

      Hello, you can send us your requests here: cwc.to/request
      - Kat

  • @ibrahimkawar4685
    @ibrahimkawar4685 Před rokem

    Hi Chris, thank you so much, would love to see you demo shift4shop REST API mainly interested in how to retrieve a list of orders.
    Thank you

    • @CodeWithChris
      @CodeWithChris  Před rokem

      HI Ibrahim! You can post tutorial recommendations here app.productstash.io/codewithchris#/ideas and we'll have our team take a look at it. :) - Pat

    • @ibrahimkawar4685
      @ibrahimkawar4685 Před rokem

      Great thank you .