swift-doc icon indicating copy to clipboard operation
swift-doc copied to clipboard

Add ability to specify entry point type

Open sindresorhus opened this issue 5 years ago • 2 comments

In my project, I use a an enum as namespacing and nest all my types inside it.

The main page looks like this: https://sindresorhus.com/playground/ However, I would like to make https://sindresorhus.com/playground/KeyboardShortcuts/ the main page. Maybe some config where I could specify the KeyboardShortcuts enum as the entry type.

sindresorhus avatar May 21 '20 07:05 sindresorhus

Honestly, I think this is something we should solve at the language level.

It looks like you could avoid the redundant namespace by using the @warn_unqualified_access annotation. Unfortunately, this only applies to function declarations, but I think we should extend that to top-level variables and constants, too

mattt avatar May 23 '20 21:05 mattt

Honestly, I think this is something we should solve at the language level.

I agree. Swift needs proper support for namespacing.

https://forums.swift.org/search?q=namespacing

It looks like you could avoid the redundant namespace by using the @warn_unqualified_access annotation. Unfortunately, this only applies to function declarations, but I think we should extend that to top-level variables and constants, too

That feels like a hack, and I assume the types would still be imported into the global namespace, just not usable without a warning.

sindresorhus avatar May 24 '20 07:05 sindresorhus