Declarative API Design in Swift

In my first real job as an iOS developer I built an XML parser and a simple layout engine - both had in common that they had a declarative interface. The parsers was driven by a .plist file that mapped XML elements to Objective-C classes. The layout engine allowed you to describe layouts in an HTML-like language (this was before AutoLayout & CollectionViews existed).

Though neither of these libraries were even close to perfect, they showed me four main advantages of declarative code:


Broken Toolchain Post Mortem

Dependency managers, IDEs, continuous integration, automated tests - all these tools are created to supercharge a developer team’s productivity. While modern development tools are amazing in many ways, they unfortunately also add maintenance burden to a project.

Ask me about migrating our Bitrise & fastlane CI workflows to Xcode 8.

The goal of this post it not to blame any individual party. I’m writing this for the following reasons:

  • share my frustration (if you’re feeling stupid for struggling with tooling, hopefully you won’t anymore after reading this)
  • keep track of the issues I encountered & fixed (always helpful, and I’ll never forget why it took 3 days to fix all CI workflows)
  • reflect on what the causes of complicated tooling are and how they might be fixed in future

I also have a somewhat special relationship to tools. I remember how, as a student, complicated tooling almost deterred me from a career in software development - “If I can’t even get a J2EE app configured and running, I probably shouldn’t be a software developer”. This post is some form of self-therapy…


Bridging Existentials & Generics in Swift 2

We are back to another episode of discussing generics, protocols with associated types and some type system limitations in Swift 2. This time we will dive into an interesting workaround that the infamous jckarter has taught me. We will also discuss how this workaround might become unnecessary through enhanced existential support in future Swift versions. But what are existentials anyway?


Real World Flux Architecture on iOS

About half a year ago we started adopting the Flux architecture in the PlanGrid iOS app. This post will discuss our motivation for transitioning from traditional MVC to Flux and will share the experience we have gathered so far.

I’m attempting to describe large parts of our Flux implementation by discussing code that is in production today. If you’re only interested in the high level conclusion you can skip the middle part of this post.


GCD's Main Queue vs. Main Thread

The correct way to ensure that code runs on the main thread / main queue is a recurring issue that causes some confusion among Cocoa developers. The topic came up again this week as part of an issue with ReactiveCocoa and MapKit:


Beware the UIKit Visitors!

Investigating the Cause of Quadratic Time Complexity When Adding Subviews in UIKit

Yesterday Two weeks ago we identified a performance regression in the PlanGrid app, when entering a view that dynamically adds a large amount of subviews.

I started this blog post back then, but was recently motivated to finish it quickly by seeing other developers running into this issue as well:


Decoding Heterogeneous Collections in Swift

The problem of decoding Swift types from an outside data source, such as JSON, has been mostly solved. Since Swift’s release we’ve seen more than a dozen popular JSON mapping libraries pop up.

However, most of the libraries I’ve seen so far deal with decoding individual types, not entire collections of heterogeneous types.


Compile Time vs. Run Time Type Checking in Swift

At some point, when learning how to use Swift’s type system, it is important to understand that Swift (like many other languages) has two different forms of type checking: static and dynamic. Today I want to briefly discuss the difference between them and why headaches might arise when we try to combine them.