On Jun 25, 2016, at 12:48 , William Squires <email@hidden> wrote:
how would I give them to someone else once I was done, without exposing everything in the swift implementation? Is there some magic tool that'll make a swift file that has only (public) interface information? My guess is yes, since I occasionally run into these when using the assistant editor pane
The answer comes in two parts:
1. For a library of “stuff”, you do the same with Obj-C: provide a framework. Like modern Obj-C frameworks, this is a module with the object code and “header” declarations.
AFAIK, there’s no Swift equivalent of a static library (.a) or of handing over a bunch of raw object files (.o). If nothing else, these have always had an inferior Xcode experience.
The only thing to keep in mind is that different versions of Swift are not ABI compatible. Whatever form you supply your stuff to someone else, they must be using the same version of Swift. 2.2, 2.3 and 3.0 are all different versions in ABI terms.
2. The code you see in the assistant editor is a “generated header”. That is, it doesn’t really exist, but is reconstructed by Xcode as pseudo-source code from the information in the module file.
|