British Swift Syntax 🇬🇧

If you’ve ever winced at the sight of Color instead of Colour, or felt despair reading try…catch when a good old “Would you mind…?” would be spot on, then this one’s for you.

I’ve put together a small, but fit and proper set of Swift tidbits that clean up the more questionable Americanisms in our lovely codebases. It’s a tiny rebellion. A syntax protest. A quiet sip of tea in the face of UIColor.

👉 British Swift Gist on GitHub


Brief & Intent

  • Inject more charm and gentleness into Swift syntax.
  • Reclaim “u” in Colour, make error handling more civil, and soften control flow language.
  • Let code read more like a conversation than a demand.

Approach

🫖 Colour.swift – Because we spell it with a u

typealias Colour = Color
static let systemMint = Colour(UIColor.systemMint)

Every time you write Colour, you’re sticking it to the red-white-and-blue spelling checker. This file maps common UIColor values to Colour for use in SwiftUI and UIKit alike.

🤔 Perhaps.swift – A gentler if/else

perhaps(isRaining) {
  print("Don’t forget your umbrella!")
} otherwise: {
  print("Looks like a cloudy day. Stay cozy indoors!")
}

Control flow with a soft touch. No more harsh if statements. Just polite suggestions.

Try this:

wouldYouMind {

    try doSomethingRisky()

} actuallyIdoMind: { error in

    print("Actually, I do mind: \(error.localizedDescription)")

}

Because nothing says “unexpected runtime failure” like pretending you’re fine with it until you’re not.

Why?

Let’s be honest: Americanisms are the base of code syntax and are everywhere, and fair play to them - it’s Apple’s language after all. But if you’re from the UK (or just a fan of proper and not simplified English), these little tweaks make your project feel more… you.

Plus, your code starts to read like a conversation rather than a set of instructions barked at a compiler.

Install

No Cocoapods, no SPM. Just drop or outright copy the .swift files into your project and start writing Swift with a cuppa in hand.

You’ll find:

• Colour.swift – For system colours with a u

• Perhaps.swift – If/else, but softer

• WouldYouMind.swift – Error handling, politely

Grab them here:

👉 British Swift Gists – GitHub

Future plans

I’m toying with the idea of adding whilst, shallWe, and ohDear. Maybe even haveAQuickLookAt.

Let me know if you’ve got any ideas or want to collaborate on a Swift Package that brings proper British values to modern codebases. We could call it BritKit or SwiftTea.


TAGS

SHARE VIA

RELATED POSTS