A consistent point of frustration for me, and a point of confusion for users new to Swift, is that nested type declarations are not allowed inside of protocol definitions (or their extensions).
Conversely, it is even more confusing that protocol definitions cannot be nested in concrete types! Imagine if instead of UICollectionViewDataSourcePrefetching, we could have UICollectionView.DataSource.Prefetching
We would not have to pollute the global namespace with types that are only relevant in the context of another.
I understand that the namespace debate has raged since before Swift Evolution was a thing. Proponents such as myself have resigned to defining our types on zero case enums. But this doesn’t work for protocols!
What do you think about allowing nested types within protocols, and protocols nested within other types?