JSON Decodable Companies
Intermediate Training Core Data
One very useful feature found in a lot of applications is to contact a backend server for data using JSON. In today's lesson, we look at how to very easily download and parse JSON objects using the Decodable protocol available in Swift 4. Because we already have Company and Employee classes created through auto generation with Core Data, we'll be using JSONCompany and JSONEmployee as Decodables. JSON Endpoint URL: https://api.letsbuildthatapp.com/intermediate_training/companies

Comments (7)
Ashim Dahal
5 years ago
do you have any idea how we get data from yahoo finance api, for stock market ? Could you share some code which download data from yahoo finance for various data available, like stock data with company name.
Kenny Ho
5 years ago
What happens if its not an array in the beginning? I've been trying to retrieve data from this Json file but am having a hard time. http://jsonviewer.stack.hu/#http://https://api.iextrading.com/1.0/stock/market/batch?symbols=aapl,fb&types=quote,news,chart&range=1m&last=5 I've been trying to retrieve symbol inside of "quote". Anyone have an idea how to retrieve json inside multiple layers?
tomrumble
5 years ago
I am also wondering about how to do this.. If you could explain this Brian it would be a big help! I assume it has something to do with nested structs but I cant figure it out.
seekerlk
4 years ago
I use Swifty JSON library to get only the section I need to pass to JSON Decoder. It works for me.
pawelcichonski
5 years ago
Is it possible to use dependency injection instead of singletons? You mentioned it once in you youtube videos but in the entire project you use two singletons (core data manager and service). Is this just your preference or in which cases would you use dependency injection over singletons (and vice versa). Singletons tend to be criticised these days (for being overused or used incorrectly). What are your thoughts on that?
Brian Voong
5 years ago
pawelcichonski
5 years ago
That's really helpful, thank you!
jpickard
5 years ago
Does Apple have any app-store restrictions as it relates to pulling remote data like this? I'd assume that remote data can't change the look and feel of an application? It'd be nice to have some formatting that could be changed by a simple JSON pull vs an app-store update. And, is it required to be on a secure site? (Note: I'm new to iOS development.)
Brian Voong
5 years ago
xuhua
4 years ago
这期帮助很大
Cinquain
4 years ago
That video was FIRE!
Cinquain
4 years ago
More fire
HELP & SUPPORT