Alan Perlis once said “fools ignore complexity; pragmatists suffer it; some can avoid it; geniuses remove it.” Today you’re going to see that in Swift code: rather than try to simplify the code for
NSCoding, the Swift team found a way to remove it entirely using the
Sometimes you won’t have a choice and need to use
NSCoding, but where possible
Codable is both easier and safer to use. You do need to know them both, though, and by seeing them both used to solve the same problem hopefully you’ll able to decide for yourself which you prefer.
Before you get down to work, here’s another fun Swift in-joke for you: sometimes you might see T-shirts with a picture of a fish followed by “able”, but before you scratch your head wondering what “fishable” might mean please remember that “COD” is a type of fish!
Today you should work through the
Codable chapter and wrap up for project 12, complete its review, then work through all three of its challenges.
Need help? Tweet me @twostraws!
SPONSORED Catch bugs as soon as they happen and know exactly why a crash occurred. Instabug's SDK grabs all the logs they need to fix bugs, crashes and performance issues in minutes instead of days. Get screenshots, device details, network logs, repro steps, and tons of other critical insights needed to resolve issues and prioritize product backlogs straight from your dashboard. It only takes a minute to integrate!
Link copied to your pasteboard.