finds.dev← search

// the find

JohnSundell/SwiftTips

★ 4,013 · MIT · updated Nov 2023

A collection of Swift tips & tricks that I've shared on Twitter

A Twitter-sourced collection of 102 Swift tips from John Sundell, covering language features, testing patterns, and API design idioms. It's a snapshot of Swift 4-era best practices from someone who clearly knows the language well. No longer updated — the author points to his blog instead.

Each tip is self-contained with before/after code that makes the point immediately obvious. The testing tips (#71, #94, #102) are particularly solid — injecting functions instead of mocking whole objects is advice that holds up. The type system tips (type aliases for identifiers, conditional conformances, associated type defaults) show real depth, not just syntax tricks. Links to companion articles give you somewhere to go when you want more context.

Frozen in Swift 4 — several tips solve problems that Swift has since solved natively (auto-synthesized Equatable, async/await making the callback patterns obsolete). The repo is just a README; there's no runnable code, no tests, no package to import. Tips #5 (using Wrap for Equatable) and #24 (enums for async results) reference patterns that are now actively wrong or superseded. Maintenance stopped in 2018, so new readers have no way to know which tips are still relevant versus which ones the compiler now handles for you.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →