Building an .app from a Swift Package Manager Executable for macOS

Hi there! I have created an executable using Swift Package Manager that is meant to run exclusively on macOS. However, I'm unsure of how to build it as an .app file. Can anyone provide some guidance on how to do this? I would be very grateful for any advice or suggestions. Thank you in advance!

There are many solutions I found on the internet, but in my case, I simply created a MyApp.app folder with the necessary structure and placed the executable there.

It sounds like you've managed to find a solution, but I'll add that I have made a tool that automates the whole process with the ability to do codesigning, customise info.plist easily, etc (my motivation was that I dislike xcodeproj's). My project is swift-bundler and it's pretty easy to setup for an existing swift package. It also supports ios but i haven't made that public yet (you can ignore the stuff about early access, because I'm going to remove that soon when I find the time, open source is hard). It also supports compiling asset bundles, app icons, metal shaders, and more as requested.

Feel free to let me know if there's anything about it that doesn't suit your use case, I'd love to hear it and use the feedback to improve the tool :)

2 Likes

Great to hear about your bundler, I came across it while looking for a solution. While it may be helpful for others, I prefer to keep things simple and avoid using third-party libraries in small projects :slight_smile:

Fair enough, would it help if there was a way to use swift bundler without a configuration file? Other than that I can't think of any other way that has less barrier to entry (short of your solution of manually creating the .app directory for simple projects). Either way, thanks for checking it out :)

Just to clarify, it's not a library but i think you accidentally misworded that.

1 Like

I believe your bundler is straightforward and well-documented. It's just a personal preference of mine, so never mind :slight_smile:

Ok, thank you :)

1 Like