JSON Parsing & Display in SwiftUI | SwiftUI | Xcode Tutorial

Опубликовано: 14 Ноябрь 2024
на канале: NDC
212
4

JSON Validator: https://jsonlint.com/
Parsing JSON Data in SwiftUI 🚀
In this video, we’ll dive into loading and parsing JSON data in SwiftUI to populate dynamic lists with ease. You’ll learn how to use Codable to decode JSON into Swift types, load a local JSON file, and display data in SwiftUI views. Perfect for beginners who want to understand the essentials of JSON handling in SwiftUI!

What You’ll Learn:

Decoding JSON with Codable: Set up Swift structs to match JSON structure.
Loading JSON from Local Files: Use Bundle.main.url to access JSON in the app bundle.
Displaying Data with Lists: Populate lists dynamically with parsed JSON data.
By the end of this tutorial, you’ll be equipped to decode, load, and display JSON data in SwiftUI, enabling you to build data-driven apps with confidence! 🎉

🔥 Download My Project Files & More! 🔥
👉 Get the source code for this project & other Swift resources here:
🔗 https://ndcswift.github.io/Swift-Proj...
Subscribe for more bite-sized lessons and full tutorials on Swift, SwiftUI, and UIKit.

Links:
Xcode: https://developer.apple.com/xcode/
Swift Documentation: https://www.swift.org/documentation/

Timestamps:
0:00 Intro
0:42 Creating a JSON file
1:30 Adding JSON to Xcode
1:55 Adding content to JSON
4:00 JSON Validator
4:48 Referencing your JSON
6:39 Decoding & Parsing your JSON
10:29 Displaying JSON data in a list
14:47 Displaying JSON data on a view
17:20 Troubleshooting - ALWAYS CHECK SPELLING
18:39 Testing on simulator
20:39 Wrap up and example