What's the difference between some Protocol and any Protocol?
some Protocol says “this returns/holds one specific concrete type that conforms to the protocol, and the compiler knows exactly which one at compile time — it’s just hidden from the caller.” Because the concrete type is fixed, the compiler can still specialize and optimize as if it were generic, and associated types resolve cleanly, so func makeView() -> some View can freely return a HStack<Text> under the hood without the caller needing to spell that type.
any Protocol says “this holds any type conforming to the protocol, and it can vary at runtime” — it’s a true existential with type erasure, dynamic dispatch, and potential heap allocation for large payloads.
In practice I use some for return types where the implementation type is fixed per call site but I don’t want to expose it — SwiftUI view builders being the canonical case — and I reach for any when I need genuine polymorphic storage, like an array of mixed any Error values or a delegate property that could be one of several unrelated conforming classes. The interview trap here is candidates treating them as interchangeable sugar; the real distinction is compile-time-fixed-but-hidden versus runtime-varying, and it affects both performance and what you can do with associated types.