August 31, 2017

Swift Tricks: Emoji Flags

Toying around with some code on the bus this morning, I came across an interesting fact about region flag emoji. Among the thousands of emoji that the Unicode standard defines, 270 of them represent region flags, each corresponding to a two-character region code: “us” means 🇺🇸, for example.

My curiosity was this: is there a way to programmatically generate the flag emoji 🇺🇸 from the string "us"? I was afraid that, like many other emoji, the flags would each have a unique name — something like REGIONAL FLAG UNITED STATES — and would require a lookup table to translate between the basic string "us" and the resulting emoji. Not so!

More
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.

More
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.

More
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 should be forthcoming. Otherwise, a brief summary of the new tidbits from the talk is as follows.

More