|
im on day 49 and when i was reading the second article i saw decoder.container which i didnt understand. Heres the full code
also i saw it on encoder aswell but i presume its the same as decoder, so ill understand once someone explains me the regular one. Also i seem to be a bit lost on the whole Codable/ data saving learning part. I grasp everything else very well but that. is there any article i could read. that would re-teach me. the same(or similar) things? or should i just re read the regular hws articles? |
|
A A keyed container is a dictionary. It contains values that are referenced by keys.
An unkeyed container is an array. It contains a list of values that can be accessed by index.
Keyed and unkeyed containers can be combined in an individual JSON file. The code
is indicating that you are trying to extract a keyed container (i.e., a dictionary) from some JSON and that the keys used in that dictionary correspond to the |
|
You could always try reading apple's documentation to see if it helps solidify some things. However, I usually find Paul's approches to be much easier to read and digest. If you look at the documentation for the Then, if you look at the documentation for the
I'm not sure if you have reached the part in the course that covers Type Generics yet. But this basically says that the So, in your example...
we are giving it The
So, when you call the That's why we have to use this afterward...
That basically says, "Take all those ones and zeroes stored in the |
|
Just realized I forgot the third kind of So, to sum up:
And, technically, every If your Something I have found most helpful is the Flight School Guide to Swift Codable, which used to cost but is now available for free download. (The sample JSON I annotated above comes from that book, in fact.) It contains numerous examples of |
|
|
|
|
SPONSORED Ready to dive into the world of Swift? try! Swift Tokyo is the premier iOS developer conference will be happened in April 9th-11th, where you can learn from industry experts, connect with fellow developers, and explore the latest in Swift and iOS development. Don’t miss out on this opportunity to level up your skills and be part of the Swift community!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.