Jacob’s Tech Tavern

Jacob’s Tech Tavern

2 Minute Tips: The Dark Secret of Optionals

They aren't what you think.

Jacob Bartlett's avatar
Jacob Bartlett
Oct 02, 2023

Psst! Come here, I’ll let you in on a secret.

Photo by Dan LeFebvre on Unsplash

Question marks, exclamation marks, chaining, coalescing? Optionals must be some Swift language magic, right?

You couldn’t be further from the truth. Open Xcode and type this in:

Optional<String>.none()

Now, quick, before anyone sees you! 

CMD+Click on the word Optional. Press enter.

After this, there is no turning back. You close Xcode — the story ends, you wake up in your bed and believe whatever you want to believe. You command-click the optional — you stay in Wonderland and I show you how deep the rabbit hole goes.

Like breaking out of the Matrix, we finally see the code that makes up our world — the world of the the Swift Standard Library. The source code for Optional.

@frozen
public enum Optional<Wrapped>: ExpressibleByNilLiteral {
    case none
    case some(Wrapped)
}

Your whole life was a lie. 

Optionals were a 2-case enum the entire time.

It’s true. 

Subscribe for free to continue reading

Enter your email and get every post from Jacob’s Tech Tavern.
Already have an account? Sign in
© 2026 Jacob Bartlett · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture