April 2, 2017

Putting Core Data on the Map

Core Data is a powerful framework for all kinds of data persistence, and its NSFetchedResultsController is a key class in many an app. However, its API – especially its delegate protocol – is aimed mostly at table views, and can be a little difficult to connect to other UI classes.

In this post, I’ll walk through the process of hooking up a Core Data stack to an MKMapView. While mostly straightforward to display NSManagedObject instances on a map, there are a few tricks to building a solid app and keeping your map data up to date.

November 26, 2015

Variable Capture and Loops in Go vs. Swift

Over the last few months, I’ve had cause to switch between writing app code – largely in Swift – and server code, almost entirely in Go. While the two languages are pretty different, on occasion I’ll stumble across a similarity that seems like it can ease the transition or lessen the learning curve.

This is a story of how one of those similarities was subtly but deeply misleading, and introduced a major bug in a Go application.

October 9, 2015

Xcoders talk: App Transport Security

This past Thursday, I had the opportunity to talk at Seattle Xcoders about App Transport Security. While the talk was mostly a distillation of my previous post on the topic, there were a few new tidbits I learned during research and followup from the original post.

If you’d like to review the slides from the talk, they can be found here; a video is available here. Otherwise, a brief summary of the new tidbits from the talk is as follows.

August 21, 2015

Shipping an App with App Transport Security

In iOS 9 and OS X 10.11, Apple introduced App Transport Security (ATS), a low-level set of restrictions on apps’ network connections. One of the most visible of these restrictions is the requirement that apps no longer make connections over plain HTTP; instead, the OS enforces the use of HTTPS unless explicitly told otherwise.

There’s already been lots of great discussion about how ATS works – see, for example, Neglected Potential’s Working with Apple’s App Transport Security. Apple has also provided a descriptive tech note on the feature, clearly documenting the expectations of ATS and the exceptions that remain available to developers. And the community has noted in several articles that turning ATS off entirely is generally a Bad Idea.

This article is aimed at a different purpose: to look at the different speed bumps that can show up while building an app alongside ATS, and to explain how to get around them. There are lots of great little tricks that have only cropped up in OS X release notes or on Stack Overflow, or that can only be discovered by building a sample app. Let’s start by digging into where ATS applies.

December 14, 2014

Learning Swift: Convertibles

Note: this post is part of a series about the Swift programming language, introduced at WWDC 2014. I’m no more experienced in Swift than anyone else outside Apple, but I learn best by coding and talking through a problem. If there’s a better way to approach some of these topics, get in touch on Twitter!

As the Swift language matures, most of the standard library has begun to settle into a stable shape. This includes a group of protocols that collectively define convertibles.

Unfortunately, we’re not talking about the cars: a convertible in Swift is, generally speaking, a data type that can be implicitly constructed from a literal. By conforming to one of the protocols in the standard library, your types can provide an extra level of convenience to you or anyone else using your code.