Topic

Module

A browsable archive of writing and notes across the site.

Post

How the .af and .rx extensions work in Alamofire and RxSwift

Another lightweight post today — this time about how the .af and .rx namespacing extensions in Alamofire and RxSwift actually work. Anyone who’s used those libraries …

Post

Method dispatch in Swift

What is method dispatch? Method dispatch is the process by which the program, at runtime, decides which concrete instruction to use when a particular method is called. Dispatch is …

Post

Protocol Extension

Protocol is the most important building block in the Swift ecosystem — the scaffolding that holds everything else together. A few of the obvious wins of using protocols over …

Post

Codable && Tuple

While learning Swift, I keep finding interesting things. Codable is one of them. Today, I defined a model with a tuple type, then Xcode gave me an error. The code might look like …

Post

A Swift quiz

A puzzle showed up on Twitter the other day. It exercises overload resolution and type(of:) together. This is just a note for myself; I’ll write up MetaType separately. // …

Post

How do dockless Mac apps work?

Menu-only apps are one of the most common patterns in Cocoa-land. They don’t take up a spot in your Dock, they don’t get in the way when you’re switching across …

Post

Adding a backgroundColor to NSView

NSView is the most basic building block in Cocoa — the foundation of every Mac app’s view hierarchy, exactly like UIView is for iOS. But the dead-simple backgroundColor …

Post

The Subjects in RxSwift

All diagrams in this post are from the book RxSwift - Reactive Programming with Swift. In the Rx world, a Subject is something that’s both an observer and an observable. The …

Post

Apple Event Sandboxing

Background I’ve been working on a small Mac app that runs an AppleScript to pull data out of OmniFocus and visualize it. Problem: it kept coming back with no data. The cause …

Post

Tracking down a Shadowsocks traffic leak

Update — 2019-01-29 First thing this morning, the moment I plugged into the office network the download rate shot up to 600 KB/s. Sure enough, it was that same …

Post

Using a C file in a Swift Framework: an exploration

The problem While building a diagnostics tool, we shipped it as a single Pod containing only pure Swift code. The Swift code needed to call into a few system C library features — …