Quantcast
Channel: Swift Package - Distribute standalone executable with bundle - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by iUrii for Swift Package - Distribute standalone executable with bundle

$
0
0

SPM compiles your resources to a separate bundle but command line tool is just an executable without a bundle and any resources you add to your executable is simply ignored by Xcode (Build Phases > Copy Bundle Resources) for Release(Archive) builds.

If you look inside Bundle.module you can find:

...// For command-line tools.Bundle.main.bundleURL,...

Where Bundle.main.bundleURL is a valid file url for the directory containing your command line executable so that it looks for your bundle next to your executable. And it works for Debug because XCode just compiles your resource bundle near your executable.

The simplest way to get Release executable with compiled .bundle file is build your package from command line:

swift build --configuration release

And then you can find them both in .build/release folder.


Viewing all articles
Browse latest Browse all 2

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>