Author: Jonathan Lehr

  • The Tuple Pattern

    The Tuple Pattern

    In Swift, a tuple is a parenthesized list of two or more elements of any type. For example, (0.5, “foo”) is a tuple where the first element is a Double, and the second is a String. One of the key benefits tuples provide is that they make it possible to write a method or function that returns more than one value.…

    Read article →

  • The Swift Enumeration Case Pattern

    The Swift Enumeration Case Pattern

    When I first started working with enumerations and switch statements in Swift, I found them immediately easy to use. I also appreciated the usefulness of being able to add properties and methods to an enumeration. Very nice! However there were a number of subtleties that eluded me initially, and took some time to fully appreciate.…

    Read article →

  • Modeling JSON Mappings – Part 1

    Modeling JSON Mappings – Part 1

    iOS apps commonly store and retrieve JSON data via REST APIs. Consequently, many development teams initially spend some time formulating an approach for decoding model objects from JSON, and (usually) vice versa. And due diligence requires sifting through a substantial number of frameworks, both in Objective-C and Swift, that provide varying degrees of support for…

    Read article →