SR-7532 "Class should not be declared public..." shouldn't apply to type aliases for public types
In some scenarios it is useful to declare typealiases internally to a module, to make it easier to implement the functionality of the module itself, but less useful to impose that typealias on clients of the module. For example, consider an image manipulation framework that can work with NSImage or UIImage instances, depending on the platform. Internally to the module, I might define:
Since I haven't marked my typealiases as 'public', the above would fail to compile. But if I mark the typealiases public, I impose a new type "RSPlatformNativeImage" on clients, when as far as they are concerned NSImage or UIImage would do the trick.
There's probably some generics + protocol way to tackle this, but that would also entail exposing unccessary type clutter (IMHO) to clients.
What would be nice in this situation is instead of giving a compiler error, Swift could simply export the method using the public type that the typealias resolves to. In which case a client of the module on iOS would see the method as:
See discussion with @AnthonyLatsis on SR-7532. The summary is that there's no real way to tell if a developer meant for a typealias to be used publicly in a function declaration (and therefore wants to know if it can't be) or if it's just being used for convenience. I think any change here would have to go through the Swift Evolution Process.