Skip to content

Swift

Decoding Heterogenous JSON with Swift and Decodable

Yet another blog precipitated by a Stack Overflow post that niggled away at me. Decoding heterogenous JSON was something that I’d done in the past, but as always seems to be the case with complex JSON decoding, it took me a while to get my thinking clear and come up with a solution.
This post details how to wrap the ambiguity of heterogenous data inside an enum with associated types for type-safe decoding with Swift and Codable.

The Curious Case of the Apple Geocoder

Apple’s reverse geocoding service doesn’t behave as advertised. It accepts multiple requests, responds to the first, but then, contrary to the documentation, ignores the subsequent ones. It doesn’t even return an error code. Why, and is there a workaround?

Pop multiple view controllers from the navigation stack

It’s easy to move back to the previous view controller in the navigation controller’s stack. Moving back more than one is trickier. Doing it elegantly even more so. This post covers how I finally came up with an elegant, generic solution to this problem.

Using Gradient Fills in UIKit

Gradient fills can add a life to any UI when used tastefully, and they are exceptionally easy to implement. Here we will fill a view with a simple gradient fill, and then change it to apply the gradient to just the view’s text.