Loading WebP Images from UIPasteboard

February 23, 2021

I recently got a bug report for Transparent App Icons to the effect of "I tried to paste in a transparent image, but it didn't work." After cropping the background to create a "transparent" image users can use for their Shortcuts icons, the app allows the user to paste an image from the clipboard to overlay and create a semi-transparent icon - this user was trying to paste a WebP image...

Read more

Writing An App In 2 Days

December 16, 2020

This September, I developed and released an iOS app called Transparent App Icons. I wrote the app (or at least, the app’s initial version) very quickly, and it’s paid off in terms of the time I put into it - in addition to being a great learning experience from a technical and business perspective, it’s generated $3,000 in proceeds since launch, which means it’s the first app I’ve put on the App Store which will contribute nontrivially to my paycheck...

Read more

New SF Symbols in iOS 14

November 21, 2020

SF Symbols, the standardized icon system for the Apple ecosystem, got some great upgrades this year. In addition to macOS support, there are almost a thousand more symbols available, and there are some changes in the symbol names...

Read more

Creating a shared unit test utils library with Xcode

August 8, 2020

I've been talking a fair amount recently about how I've been writing a lot of unit tests for Fluency, my Confluence editor app, and how much I value having good tests to catch regressions and verify that the editor is actually working correctly. In the case of Fluency, I now have 70+ tests which test various parts of the app, and I've extracted various utils out of the actual...

Read more

Self-Sizing UITableView Cells with SwiftUI

July 20, 2020

It's been a year since SwiftUI was released, and many iOS developers who are lucky to only support the two most current iOS versions will soon be able to start writing SwiftUI in their production apps. There are clear benefits to using SwiftUI (I could probably devote a whole post to them), so the question I've been thinking about is: where to start?

Read more

Automatic preview updating paused

July 4, 2020

I've been rewriting parts of CIFilter.io in SwiftUI, and one issue I ran into recently was that SwiftUI previews didn't seem to work as advertised. When I opened the preview, it would trigger an app build, eventually show up, but there would always be a banner telling me that previewing had been paused...

Read more

SwiftUI Crash in AG::LayoutDescriptor::compare

July 2, 2020

I've been working lately on rewriting some of CIFilter.io in SwiftUI. One crash I came across that initially stumped me would happen when resetting my UIHostingController's rootView to a view that was equivalent to the one already set...

Read more

Expression shuffles the elements of this tuple; this behavior is deprecated

June 24, 2020

Whenever a new major version of Xcode is released, one of the first things I do is download it and run it with the various codebases I'm working on. Usually the new version of Swift is smarter and can surface more warnings and diagnostics, and the Xcode 12 beta release earlier this week (with Swift 5.3) is no exception...

Read more

SwiftUI: Two equal width columns

June 16, 2020

A problem that many people run into after writing enough SwiftUI is how to make it so that two views inside an HStack have equal width, such that if the HStack grows both inner views expand proportionally...

Read more

Swift Tip: Refactoring a Private Method for Testability

May 27, 2020

Writing testable Swift code is an ongoing process, so much so that you could write a book about it, but yesterday I was reminded of a really great insight I read long ago in Working Effectively with Legacy Code about testing private methods...

Read more

Nested Property Wrappers in Swift

May 10, 2020

You can nest property wrapers in Swift, but it's difficult. NSHipster has a great article about all things property wrappers, and the summary of trying to compose them (which others have echoed) is that it's hard and prone to compiler errors...

Read more

Writing a UserDefaults editor with SwiftUI and property wrappers

May 4, 2020

I've been talking a lot online about how useful SwiftUI has been in building debug components for Fluency - debug menus are one of the places where you can start using SwiftUI right now..

Read more

Gatsby with Tailwind CSS

April 25, 2020

When creating the site for Fluency, I figured now was as good a time as any to try out Tailwind CSS. Like all static sites I build nowadays, the site runs on Gatsby, but unfortunately the docs on how to integrate Tailwind with Gatsby are quite complicated...

Read more

Implementing Amplitude analytics in a macOS app

April 19, 2020

I've been moving towards Amplitude for analytics in my personal apps, since it seems to have the best user experience and easiest itegration vs Google Analytics and Mixpanel (plus, it has a free tier!), but I only recently implemented analytics in a macOS app...

Read more

NSTextStorage: Crash in didProcessEditing

February 22, 2020

When you're writing an editor, a common feature is to intercept the user's typing and automatically edit the text, to make writing easier. For example, if we're typing in a list, we might want to automatically insert another bullet point when the user presses enter...

Read more

Something went wrong installing the "sharp" module. Module did not self-register.

February 21, 2020

I spent more time than I'd care to admit today trying to debug why my Github Actions workflow to automatically deploy new versions of noahgilmore.com on push to master was failing. The site is build on Gatsby, and the pipeline runs gatsby build, but I was running into the following error on every push...

Read more

Processing shift-tab (backtab) events in NSTextView

February 21, 2020

I'm writing a Mac App which includes an NSTextView. One of the things I found difficult to discover online is how to respond to when the user presses shift-tab while editing in the text view - I wanted to intercept this event to de-indent a list item...

Read more

Animating Metal Content with CoreAnimation

December 9, 2019

Recently, I've been learning more about Metal - I'm still working through the basics, but I've written a couple of posts and tweets about it, and I'm about halfway through Metal By Example. Up until now I've mostly been coding sample projects, but I recently had the opportunity to prototype a Metal implementation integrated into our production app at work...

Read more

Sponsored Content

November 24, 2019

When browsing noahgilmore.com/blog starting today, you may see sponsored sections like this. I'll be piloting these sponsored sections on some posts (generally the longer form, higher effort ones) in the coming months. Writing high quality content on this blog takes a fair amount of work...

Read more

ImportError: No module named zlib on macOS Catalina

November 22, 2019

A few times now, I've had to get around an issue that happens on macOS Catalina where you try to run a Python script and it fails with an import error...

Read more

GPU Capture Button Flickering

October 27, 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...

Read more

Relative date time formatting in SwiftUI

October 18, 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...

Read more

ColorCompatibility Library

October 4, 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...

Read more

iOS 13 UIWindowScene Black Screen

September 20, 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...

Read more

Popovers, UINavigationController, and preferredContentSize

August 25, 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...

Read more

The application's CFBundleVersion is invalid

August 21, 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...

Read more

Taking Down Assets from SFSymbols.com

August 19, 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...

Read more

Docker Commands I Can Never Remember

June 13, 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...

Read more

Backwards compatibility for iOS 13 system colors

June 8, 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...

Read more

UIButton: Padding Between Image and Text

May 5, 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...

Read more

Passing data through the App Store with UIPasteboard

April 14, 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...

Read more

CIFilter.io (Core Image Filter Reference)

March 30, 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...

Read more

CIVector Codable

March 4, 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...

Read more

Dead Simple Dependency Injection in Swift

February 14, 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...

Read more

iOS Color Wheel Using CIFilter

January 27, 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...

Read more

RxSwift: Multiple subscribers for a unit of work

December 7, 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...

Read more

Installing Nokogiri from a Gemfile on Mojave

November 13, 2018

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

Read more

Accessing MDX Frontmatter in Gatsby

November 7, 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...

Read more

Easy Gatsby Image Components

November 1, 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:

Read more

How NOT to set nil in UserDefaults

October 21, 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.

Read more

Casting a pointer to UInt in Swift

October 15, 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.

Read more

NSObject Equality is Tricky

November 12, 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)])

Read more

Syntax trees with Pyparsing

October 22, 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.

Read more

My Bucket List

May 19, 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.

Read more

Tables are hard

April 2, 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>

Read more