Last time we talked about how we could simplify our JSON parsing with Swift 2 error handling and get rid of all the magic. Today we’re going to use the power of type inference to take our old
JSONObject struct from having 12 methods (or more, if you want to add methods for values like CGFloat, etc.) to only 4!
Since the beginning, JSON parsing has been a common pain point for many Swift developers. This is largely due to difficulties in dealing with a strict type system (which JSON does not have) and optionals, as well as a lack of a consistent error handling approach.
Swift 2.0 is causing a lot of well deserved excitement. Chris and the folks over at
apple have been doing an amazing job.
I have been loving Swift the past year and am really excited about all the new
features—and, of course, the open source announcement.
The forward pipe operator is an infix operator taken from languages like F# and Elixir. I’ve been
working on a Swift implementation that will help clean up data