Switch between distributing code as source / as a binary

I'm getting confused reading conflicting information about Swift Packages (for example, many sources say its for distributing source code only, but Apple's documentation says a binary framework can be included in them).

What I would like to be able to do is to distribute a project as a binary to external customers (so they cannot see the source code) but distribute it as source code for internal consumption (so when developing a test app that uses the project, source code can be stepped through in the debugger etc.)

Is the feasible/easy? Could a package manifest be created that can easily be flipped between creating a package containing source only, and a binary only. Or would it be better to have two separate manifests?

I'm getting confused reading conflicting information about Swift Packages (for example, many sources say its for distributing source code only, but Apple's documentation says a binary framework can be included in them).

Well, it’s both! SwiftPM supports both source and binary packages, with the caveat that the latter is currently [1] only supported on Apple platforms.

Is the feasible/easy?

I don’t think it’s easy, in that you’d be straying far from the beaten path. However, it’s certainly feasible. Probably the easiest option would be to have two separate packages, with the internal one containing source and the external one containing a binary. You’d then build the latter from the former.

The main complication with that is that your internal users would have to use a different URL to access the package. But that’s probably the case anyway, because you want to keep the source code private.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] If you head over to Swift Forums you’ll see that folks are interested in supporting binary packages on other platforms.

Switch between distributing code as source / as a binary
 
 
Q