GPU Capture Button Flickering

October 28, 2019

One of the "Things I Don't Know" in the iOS ecosystem is Metal. As such, I've been working through Metal By Example recently, which still stands as a great introduction to Metal...

Relative date time formatting in SwiftUI

October 19, 2019

In the wild world of 2019 SwiftUI development, lots of things aren't documented. One such thing I ran into recently was the usage of RelativeDateTimeFormatter in a Text view...

ColorCompatibility Library

October 5, 2019

I wrote previously about a technique I use in Trestle and CIFilter.io to support iOS 12 and lower while still using system provided, dark-mode accessible colors...

iOS 13 UIWindowScene Black Screen

September 21, 2019

I've encountered this bug enough times that I figured it was time to write a quick post about it. If you've looked into multiple window support for your app in iOS 13, you might know that a lot of the setup you used to have to do in the app delegate now lives in the scene delegate instead...

Popovers, UINavigationController, and preferredContentSize

August 26, 2019

In this post we'll look at a very specific but tricky interaction in UIKit, one which took me multiple days to work out how to implement. It's two view controllers of different sizes, pushed on a UINavigationController, which is presented as a popover. The view controllers...

The application's CFBundleVersion is invalid

August 22, 2019

For some reason lately, I've been having a lot of trouble installing apps and running tests in the iOS simulator on Xcode 10 (non-beta). The error message looks like this...

Taking Down Assets from SFSymbols.com

August 20, 2019

At the beginning of June, I launched sfsymbols.com since there wasn't a reference available on the web for searching and filtering the list of 1500+ system icons included in...

Docker Commands I Can Never Remember

June 14, 2019

I'm a Docker noob, and for whatever reason, I can never remember the best way to do things with Docker, whether it's checking which containers are running or starting/stopping them. Putting some common commands here mostly for personal reference. List containers...

Backwards compatibility for iOS 13 system colors

June 9, 2019

At WWDC 2019, Apple announced that Dark Mode would be supported on iOS 13. There are some significant changes to UIKit in order to support this - many of them are detailed in the talk Implementing Dark Mode on iOS which I'd highly recommend watching...

UIButton: Padding Between Image and Text

May 6, 2019

Pop quiz: in a UIButton, how do you set a padding of 10pt between the image and the title? I had to do this at work recently, and I was surprised at how hard it was to reason about. There are several posts talking about this topic (including this one which uses edge insets to flip the title and image!), but the answer for my use case was pretty hard to find...

Passing data through the App Store with UIPasteboard

April 15, 2019

About a year ago I wrote a puzzle game called Trestle. If you download it using any of the links in this post (by clicking on them on your iOS device), you'll get a nice Easter egg and two of the (normally paid) level sets enabled for free...

CIFilter.io (Core Image Filter Reference)

March 31, 2019

Today I'm launching CIFilter.io 🎉 CIFilter.io is a project I've been working on for the last few months, and today it's open source. It has two parts...

CIVector Codable

March 5, 2019

For my current side project, I have to export CIFilter parameters to json, and I've been running into issues with various CoreImage types not conforming to Swift's Codable...

Dead Simple Dependency Injection in Swift

February 15, 2019

At the most recent Swift Language User Group meetup, Patrick Barry presented a great talk about how Lyft implements dependency injection. I'd highly recommend watching the video - I was impressed by how clean and...

iOS Color Wheel Using CIFilter

January 28, 2019

After struggling for some time with CIFilter documentation at work, I've been working on an app which can apply filters interactively for various inputs...

RxSwift: Multiple subscribers for a unit of work

December 8, 2018

I've been working on a side project for better CIFilter documentation lately, and I decided this was as good of a time as any to try out RxSwift. We use reactive programming at work, but I haven't really been able to dig into it yet...

Installing Nokogiri from a Gemfile on Mojave

November 14, 2018

Another MacOS and another struggle through installing nokogiri. Most places online recommend using...

Accessing MDX Frontmatter in Gatsby

November 8, 2018

While building this site in Gatsby using MDX, I noticed that there wasn't any documentation on how to include data from the frontmatter of an MDX document in the document's page layout...

Easy Gatsby Image Components

November 2, 2018

I use Gatsby as a static site generator to build this blog using React. As part of this, I wanted a simple component to display a static image, something like this:

<Image filename="myimage.png" />

Surprisingly, this is hard to do in Gatsby. The default Image component generated by Gatsby uses StaticQuery:

How NOT to set nil in UserDefaults

October 22, 2018

To clear a value from UserDefaults, I previously thought it was fine to do something like this:

UserDefaults.standard.set(nil, forKey: "myKey")

Turns out that this works differently in different iOS versions. Starting in iOS 11, setting nil for a key works as I expected.

Casting a pointer to UInt in Swift

October 16, 2018

There are some times in Swift, like when using System Trace, that you want to get the pointer value of an object directly as a UInt (passing the pointer to kdebug_signpost is one). I was surprised at how hard it was to find documentation on how to get a Swift reference’s pointer value as a UInt.

NSObject Equality is Tricky

November 13, 2016

Swift can be tricky sometimes. For example, what does the following print?

class A: NSObject {
  let x: Int

  init(x: Int) {
    self.x = x
  }
}
func ==(left: A, right: A) -> Bool {
  return left.x == right.x
}
print(A(x: 1) == A(x: 1))
print([A(x: 1)] == [A(x: 1)])

Syntax trees with Pyparsing

October 23, 2016

Let's talk about syntax trees. In static analysis, a common operation is to take a character string (e.g. "x = 1") and transform it into well structured data. Let's try to do this in python. We'll use Pyparsing as our tokenization tool.

My Bucket List

May 20, 2014

Ambitious, subject to change, incomplete, based on this. 1. Create something that touches 10,000 people. (January 20th, 2013) 2. Create something that touches 100,000 people. (January 14th, 2015) 3. Create something that touches 1,000,000 people.

Tables are hard

April 3, 2014

Let’s talk about HTML tables. Here’s some code:

<table class="main">
  <colgroup><col class="votes"><col></colgroup>
  <tr>
    <td>Votes</td>
    <td>Comments</td>
  </tr>
  <tr>
    <td>
      <p class="vote-desc">Some long name, really long, like really super long</p>
      <p class="vote-desc">Another long name, really long</p>
    </td>
    <td>
      <p class="comment">A really, really, really, really, really really really really really, really long comment.</p>
    </td>
  </tr>
</table>