[swift unboxed]

Safely unboxing the Swift language & standard library


Recent Articles

Hashable

Hash values in Swift: more than just XOR.

Synthesized Conformance to Equatable

Investigating compiler magic for automatically synthesizing Equatable conformance.

Equatable

Adventures in Swift value equality.

Swift Language

Conditional Conformance

Thinking through conditional conformance in Swift, and working through the basics of its implementation.

The Strange Case Of Mapping Over Optionals

Map and flatMap are usually collection operations — why would you use them with optionals?

Reduce

Map and filter get all the glory, but reduce is the quiet workhorse.

Escaping and Nonescaping Closures in Swift 3

What are escaping and non-escaping closures, and how have they changed in Swift 3?

Swift Likes ML Option Types

Looking at Swift optionals through an ML lens.

Function Types

A quick example of what function types look like in Swift.

Swift Internals

Synthesized Conformance to Equatable

Investigating compiler magic for automatically synthesizing Equatable conformance.

Swift Diagnostics: #warning and #error

New diagnostic directives in Swift 4.2. What are they and how are they implemented?

Simulator Detection with targetEnvironment

New in Swift 4.1: easier detection and conditional compilation for targeting the simulator.

Size, Stride, Alignment

The basics on the memory layout of Swift struct instances.

Protocols

Hashable

Hash values in Swift: more than just XOR.

Equatable

Adventures in Swift value equality.

Swift's Numeric Protocol

What’s in a Swift number?

BooleanType

Boolean-ize all the things!

CustomPlaygroundQuickLookable

Notes and playground on using the CustomPlaygroundQuickLookable protocol.

Lessons From the Swift Standard Library Protocols

How does the way the Swift standard library uses protocols give us hints on how we should do it? Based on a talk given at Swift Summit San Francisco 2015.

Standard Library

Swift Substrings

When is a (sub)string not a string? Always and never.

JSON to Swift with Decoder and Decodable

Let’s decode some decodables, from JSON to Swift.

JSON with Encoder and Encodable

Encoding a simple value to JSON, one step at a time.

Map

It iterates, applies, transforms, collects. It's your functional best friend, map.

IteratorOverOne

Start at startIndex, iterate one step forward, and you’ve learned the secrets of IteratorOverOne.

CollectionOfOne

Start digging into collection types in Swift starting with the simplest of them all: CollectionOfOne.

Open-source Swift: Booleans

Open-source Swift is here! A close reading of the source to the black-and-white cookie of the standard library: Booleans.

Objective-C Interop

@objc and dynamic

Objective-C runtime visibility and the depths of dynamic dispatch in the modern Swift era.

Nullability Annotations in Objective-C

Bridging Objective-C into Swift with the correct optionality using nullability annotations. Based on a talk given at 360iDev 2015.

Bridging Swift to Objective-C

Bridging your Swift objects into the world of Objective-C. Based on a talk given at 360iDev 2015.