Grindr Max Roche Jul 29, 2025

Building Reusable Custom Views with SwiftUI

Article Summary

Max Roche from Grindr Engineering just solved one of SwiftUI's most annoying problems: why do custom components require massive initializers while Apple's native views stay clean and simple?

Building reusable SwiftUI components typically leads to bloated initializers with dozens of optional parameters. Grindr's iOS team analyzed why Apple's native components avoid this problem and built a macro to bring the same elegance to custom views.

Key Takeaways

Critical Insight

The @ViewConfigurable macro automatically generates SwiftUI-style modifier functions, eliminating boilerplate code while keeping custom component APIs clean and familiar.

The article includes the exact implementation pattern and shows how the macro inspects your configuration struct to generate the extension functions automatically.

About This Article

Problem

Grindr's custom SwiftUI components ran into trouble as the product team kept adding requests. A single button component started with 2 required parameters and ballooned to 8+ optional ones. Developers had to juggle complex initializer ordering and write out lengthy function signatures.

Solution

Max Roche's team built the @ViewConfigurable macro. It automatically generates modifier extension functions by reading a ViewConfiguration struct. This removed the need for manual boilerplate code while keeping SwiftUI's clean modifier-chaining syntax intact.

Impact

Now developers can create components with just the required parameters and customize the rest through method chains. GrindrButton("Click Me", onAction: {}).titleColor(.blue).buttonBackgroundColor(.red) works the same way Apple's native components do, without needing hand-written extension functions.