M-Swift All articles
Swift Architecture

Plain Structs, Clear Code: The Case Against Clever Swift Architecture

M-Swift
Plain Structs, Clear Code: The Case Against Clever Swift Architecture

Photo: Vauxford, CC BY-SA 4.0, via Wikimedia Commons

I like abstractions. I like protocols, generics, dependency injection, and the satisfying click of a well-drawn boundary. I have also spent too many afternoons tracing a single button tap through six layers of Swift code that were all introduced for the same reason: someone wanted the codebase to be ready for change.

Here is the uncomfortable part. Most of that change never comes. What does come is a new hire, a production bug, and a feature request that should take two days and takes five because nobody can find where the actual work happens.

In 2026, with Swift 6 concurrency rules settling into everyday practice and teams shipping to more platforms than ever, the case for boring Swift is stronger than it used to be. Not simplistic Swift. Boring Swift. Explicit, concrete, and easy to delete.

The Cost of a Clever Codebase

A simple feature in a clever codebase often looks like this: the view calls a view model, which calls a use case, which calls a repository protocol, which is injected through a container, which resolves a service that wraps a client that finally talks to the network. There are five protocols involved. Three of them have exactly one implementation. One exists only because a mock needed it in a test.

None of this is evil. It is just expensive. Every layer adds a place to look, a file to open, and a decision to understand. The cost shows up in onboarding, debugging, and the tiny mental tax of wondering whether you are allowed to call a concrete type directly.

Protocols Are Not Free

Protocols are wonderful at boundaries. They are less wonderful as a default decoration. If a type has one implementation and no realistic plan for a second, a protocol often adds indirection without adding clarity.

Use a protocol when you have a real seam: a networking boundary, a hardware capability, a third-party SDK, a clock or scheduler that needs test control, or a contract shared across modules. Otherwise, reach for a concrete struct and move on. Swift's value types are already easy to test. You can pass a real struct into a function without a mocking framework and still have a good day.

Dependency Injection Containers Can Hide the Graph

A container is not architecture. It is a lookup table. When every dependency is resolved from a global container, the actual dependency graph becomes invisible. You cannot tell what a type needs by looking at its initializer, because its initializer takes a resolver and then asks for things later.

A boring alternative is explicit initializer injection. If a view model needs an API client and a date provider, put them in the initializer. If that initializer has nine parameters, that is not a container problem. That is a design signal. The type is doing too much, or the feature boundary is in the wrong place.

For app-level wiring, a small composition root is fine. Create the real objects once, pass them down, and let the compiler tell you when something is missing. It is less magical and much easier to debug.

Layers Should Earn Their Keep

Architecture layers are not badges. A domain layer, a data layer, and a presentation layer make sense when the app has real domain complexity or multiple data sources. They make less sense for a settings screen that reads a boolean from UserDefaults.

A practical rule: add a layer when it removes a real problem you have today. Not a problem you might have after a rewrite. Not a problem a conference talk convinced you to prevent. Today.

Feature folders are a boring, effective compromise. Keep the view, view model, models, and networking calls for one feature close together. Let module boundaries do the big structural work. Inside a module, prefer a clear path over a ceremonial one.

Smaller Modules, Bigger Clarity

There is a version of modularization that helps: one module per feature, explicit imports, and a small shared core. There is another version that hurts: dozens of micro-modules with circular dependencies and a build graph that looks like a highway interchange.

Boring modularization means a new engineer can open a feature folder, see its dependencies, and run its tests without loading the entire app in their head. If a module exists only to hold three extensions, it is probably a folder.

When Abstraction Pays

I am not arguing against all abstraction. I am arguing against abstraction as a reflex. It pays when you have multiple real implementations, a boundary you need to fake in tests, a cross-team contract, or a dependency that changes often and unpredictably.

Apple's own concurrency tools show the useful version of this. A Clock abstraction is valuable because time is a genuine boundary and tests need control over it. A protocol around every model type is usually not.

A Boring Checklist

Hiring and Debugging Are Architecture Tests

A codebase is not judged only by how it feels to the person who designed it. It is judged by how quickly a new hire can fix a bug, how easily a debugger session makes sense, and how confidently someone can delete code that is no longer needed.

Clever architecture often optimizes for the author's taste. Boring architecture optimizes for the team's Tuesday. In 2026, with more Swift code generated, reviewed, and maintained by mixed-experience teams, that difference matters.

Plain structs, explicit dependencies, and fewer layers are not a lack of ambition. They are a decision to spend complexity where it buys something real. Ship the feature. Leave a clear trail. That is the win.

All Articles

Related Articles

Where Did the Sprint Go? A One-Week Build-Time Audit for Swift Teams

Where Did the Sprint Go? A One-Week Build-Time Audit for Swift Teams

Paying for Smarts: The Hidden Cost of On-Device AI in Your Next Swift Release

Paying for Smarts: The Hidden Cost of On-Device AI in Your Next Swift Release

From Compiler Warnings to Calm Waters: A 2026 Swift 6 Concurrency Migration That Won't Stomp Feature Work

From Compiler Warnings to Calm Waters: A 2026 Swift 6 Concurrency Migration That Won't Stomp Feature Work