Sitemap
The Swift Cooperative

Authors publishing advanced articles on Swift and SwiftUI application development.

Navigator and External Destinations

Obtaining and using external views in a modular application.

6 min readOct 5, 2025

--

Press enter or click to view image in full size

I’ve written at length about NavigationDestination types, also known as enumerated views. Fundamentally, a destination is a View. Ask an SwiftUI enumerated destination to display itself, and it will.

NavigationDestination’s can be pushed, presented, and manipulated as needed. Passed and returned as values. They’re extremely powerful architectural concepts on which Navigator and many other SwiftUI-based navigation systems are founded.

But they do suffer from one drawback.

Namely that they require the destination to provide the views needed as part of the protocol requirements. They are Views, after all, and views must have a view body.

And in many cases that’s not a problem.

public enum SharedDestinations: NavigationDestination {
case newOrder
case orderDetails(Order)
case produceDetails(Product)

public var body: some View {
switch self {
case .newOrder:
NewOrderView()
case .orderDetails(let order):
OrderDetailsView(order)
case .produceDetails(let product):
ProduceDetailsView(for: product)
}
}
}

--

--

The Swift Cooperative
The Swift Cooperative

Published in The Swift Cooperative

Authors publishing advanced articles on Swift and SwiftUI application development.

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

Responses (1)