Why can't Protocols be nested in other Types?

We can nest classes, structs & enums:

class TestClass {
     class OtherClass {}
     struct OtherStruct {}
     enum OtherEnum {}
}


Why can't we also nest protocols?

class TestClass {
     protocol Delegate {}  // error: Declaration is only valid at file scope
}


So far the workaround is to declare it at file scope using and use a typealias instead.

The underscore prefix makes it clear that the global symbol name is not intended for direct use.

class TestClass {
     typealias Delegate = _TestDelegate
}

protocol _TestDelegate {}


Is this just not yet implemented or is there a reason for not supporting that at all?

As in your linked text: to separate helper classes. This functionality has gone superfluous with the introduction of private. Now you simply put the helper classes in the same file and make them private.

Delegates like most other protocols are not helper classes…

Their whole intention is not be non-private so others can implement them.

So please think what you just wrote and explain why you are wondering that protocols can't be nested in Swift...

You are not helpful at all.

Why can't Protocols be nested in other Types?
 
 
Q