Member-only story
Advanced Codable: Missing Fields In Arrays (Swift)
Decode without try
3 min readJan 4, 2023
Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 14.2, and Swift 5.7.2
This article is “inspired” by the current implementation of Decodable
. If we have missing fields in an Array which we wish to decode, what are we to do?
Read on to find out what can possibly be done about this!
Prerequisites:
- You will be expected to be aware of how to make a Single View Application in Swift.
- It would be great to have some background regarding decoding JSON
Terminology:
Decodable: A type that can decode itself from an external representation
JSON: JavaScript Object Notation, a lightweight format for storing and transporting data
The Code
The Basics
try** this