Sylvan M.
Sylvan M.

Reputation: 190

Have hidden implementation of functions in Swift like in the documentation?

I am building a rather large library and I think it would be a lot cleaner if I could have the implementation for my methods and such hidden. For example, when you view the in-code documentation for standard Swift types, such as UInt64, you see things like:enter image description here

With the actual implementation of the methods hidden, and only the declarations and headers shown. How can I do this with my own library?

Upvotes: 5

Views: 1202

Answers (2)

zgjie
zgjie

Reputation: 2274

There is a shortcut in Xcode to show only the interface: Control+Command+Up Arrow, but it is a little slow and doesn't hide the internal methods that not useful for the usage of the code (since only public and open interface in Swift Package can be used by outside module).

Upvotes: 0

David Pasztor
David Pasztor

Reputation: 54716

You need to distribute your library as a precompiled binary, in which case only the public headers + documentation will be visible for consumers of your library.

For more information, you can watch the WWDC2019 video of about Binary frameworks in Swift.

Upvotes: 6

Related Questions