Topic

Translation

A browsable archive of writing and notes across the site.

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

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 — …

Post

Making a "Send to 2Do" Safari bookmarklet

Drag the link below onto your Favorites Bar. The default click behaviour simulates navigation on the current page, and the destination URL is whatever you put after …

Post

My reading workflow

I’ve been tightening up my reading workflow lately, so here’s an update. The tools involved: DEVONThink Pro PDFExpert MarginNote (1) is the inbox and archive; (3) is …

Post

Testing Swift code that uses system singletons in 3 easy steps

Original: Testing Swift code that uses system singletons in 3 easy steps Original author @johnsundell Most apps built on Apple platforms lean on singleton-based APIs. From …

Post

Avoiding singletons in Swift

Original: Avoiding singletons in Swift Original author & Copyright @johnsundell “I know singletons are bad, but…” — you hear it all the time when developers are …

Post

Different flavors of dependency injection in Swift

Original: Different flavors of dependency injection in Swift Original author & copyright: @johnsundell In previous posts we’ve looked at several ways of using dependency …

Post

My favourite Mac apps

A running list of the Mac apps I reach for. Every time I reinstall macOS, I forget to grab one or two of these and only notice once I actually need them (I don’t always …

Post

What is LLVM

What is LLVM? The secret behind Swift, Rust, Clang, and more Understanding how a compiler emits native machine code makes it dramatically easier to invent a new language or enhance …

Post

In-app purchase

If your app ships on the App Store, in-app purchase (IAP) is something you can’t really avoid. Last year’s spat between WeChat tipping and Apple put IAP in the …

Post

Dependency injection using factories in Swift

Original: Dependency injection using factories in Swift Original author & copyright: @johnsundell Dependency injection is one of the key tools for making code more testable. …

Post

Modularising Xcode projects

Original: Modular Xcode projects Author & Copyright @pepibumur Translator: @OgreMergO Building a modular Xcode project takes a real understanding of project structure and the …

Post

Handling non-optional optionals in Swift

Original: Handling non-optional optionals in Swift Original author & copyright @johnsundell Optionals are arguably one of the most important features of Swift, and one of the …

Post

Understanding responders and the responder chain

Apps receive and handle events through responder objects. A responder is an instance of the UIResponder class — and UIView, UIViewController, and UIApplication, all the usual …

Post

Capturing objects in Swift closures

Original: Capturing objects in Swift closures Original author @johnsundell Ever since blocks were introduced to Objective-C in iOS 4, they’ve been a core part of the most …

Post

@autoclosure && @escape

Closures are first-class citizens in Swift, which means you can pass them around as arguments. While learning Swift, you keep running into keywords that decorate these closure …

Post

Everything you need to know about iOS 10 notifications

Overview Push notifications are something we’re all familiar with — pretty much anyone with a smartphone gets interrupted by them every day. The right notification is a …

Post

Building an elastic view animation with UIBezierPath

Original: Elastic view animation, or how I built DGElasticPullToRefresh Author: @gontovnik DGElasticPullToRefresh demonstrates a springy elastic effect. Here’s what it looks …

Post

A bit about Category in Objective-C

A category in Objective-C is a compile-time mechanism that lets you tack extra methods onto an existing class. There’s one catch: you can’t add new instance variables …

Post

Understanding the Objective-C runtime

The Objective-C runtime is one of those language features that’s easy to overlook when you’re just stepping into Cocoa/Objective-C land. The reason is simple: …

Post

How we built the Guillotine menu animation for iOS

Original: How We Created Guillotine Menu Animation for iOS Author: @johnsundell Ever wondered why nearly every app’s menu is a sidebar? Why isn’t it a topBar, a …