Swift Bundler: create macOS apps with SwiftPM instead of Xcodeproj's

Hi all!

I recently released v2.0.0 of Swift Bundler — A tool for creating macOS apps with Swift packages instead of Xcodeproj's. This release sports a whole new suite of features such as package templates, and a delightful revamped CLI experience.

Motivation

Escape Xcode

As Swift support in VSCode & Co improves there is real value in being able to free our projects from the bounds of Xcodeproj's. Many of us know exactly how frustrating it is when syntax highlighting breaks, auto complete stops working or Xcode crashes and we can't do anything to fix it. VSCode and many other code editors are open source (along with their extensions) and the community can easily step up and fix bugs.

However, if you still want to use Xcode, Swift Bundler has excellent support for running and building through Xcode.

A cross-platform future

In the future I hope to add support for other platforms such as Linux, Windows, iOS, Android and more (contributions welcome :wink:). Along with an easy to use cross-platform UI framework (such as my WIP SwiftCrossUI) I believe that Swift could be a great language for developing performant and native cross-platform apps.

Easy to use with CI

Xcodeproj's can be a bit cumbersome to use with CI solutions such as GitHub Actions in my experience (with code signing and all). In contrast, Swift Bundler is extremely easy to use:

jobs:
  build:
    runs-on: macos-latest
    steps:
      # ...
      - run: |
          curl -o swift-bundler -L https://github.com/stackotter/swift-bundler/releases/download/v2.0.2/swift-bundler
          chmod +x ./swift-bundler
      - run: ./swift-bundler bundle -c release -o . -u
      # ...

Contributing

I won't have much time to work on new Swift Bundler features for a few weeks, and I would be very grateful if anyone wants to try their hand at adding support for a new platform, codesigning, sandboxing or any other features you can think of.

Architecture

When rewriting Swift Bundler I decided to use it as a playground for trying out a more functional style of Swift programming with precise error handling at its core, and I think it would definitely be useful for anyone involved in the precise error handling discussion to take a look and see a real-life example of precise error handling in action in Swift with the currently existing utilities. I think it would help with identifying the current points of friction that prevent most people from using precise error handling in tools and internally within frameworks.

Example use case

For an example of using Swift Bundler in a large real-world project, see Delta Client.

16 Likes

Hi I would like to learn and help as I am also developing desktop app for Mac OS. Would be happy to get started. :slight_smile:

Thanks for your interest! The Swift Bundler docs should help you get started. To try out a basic SwiftUI hello world example, just install Swift Bundler and then run the following commands:

swift bundler create HelloWorld --template SwiftUI
cd HelloWorld
swift bundler run

Currently I am not accepting contributions, as I am working on iOS support (which is sponsor-only at the moment). But I will resume accepting contributions in the future.

Hey, really sorry about the whole sponsor-only thing, it was a bit of an experiment to see if I could support myself to continue working on open source with most of my spare time, but it wasn’t working. I’ve gotten a job since then which means I have less time for open source, but at least I don’t have to try getting sponsors for it. I finally got around to getting rid of the whole sponsor only thing a few weeks ago.

If you’re still interested there’s now also iOS support, and Linux support is in the works. Completely understand if you’ve moved on though