You've seen some View in every SwiftUI file you've ever opened. Now let's find out what it actually means, why it exists, and why returning a plain protocol doesn't work the same way.

Fair warning: this topic is genuinely one of the more brain-bendy things in Swift. I'm going to tell you upfront that you don't need to fully understand the internals to keep going โ€” but you do need to know it exists and roughly what it's doing, because you've already been using it every single time you've written a SwiftUI view.

That some View in every SwiftUI file? That's an opaque return type. And now we're going to actually understand what that means. ๐Ÿฅ

Let's Start With Something That Works

Two simple functions: