swift-bundler
swift-bundler copied to clipboard
Support for bundling XPC Services
I would like to use swift-bundler to create an app that includes an XPC Service. For that the resulting .app directory needs to contain a directory Contents/XPXServices which in turn contains .xpc bundles.
A first step to make this possible would be to support dictionaries dictionaries as additional plist entries:
[apps.ServiceProvider]
product = "ServiceProvider"
version = "0.0.1" # The apps can specify separate versions
[apps.ServiceProvider.extra_plist_entries]
CFBundleIdentifier = "com.my.ServiceProviderXPC"
CFBundlePackageType = "XPC!"
XPCService = { ServiceType = "Application" }
results in
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.my.ServiceProviderXPC</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>XPCService</key>
<dict>
<key>ServiceType</key>
<string>Application</string>
</dict>
</dict>
</plist>
Given this I could already add a manual step that adds my ServiceProvider to the already created bundle.
Would you be able to provide an example xcode project with an xpc service so that I can see how the resulting app bundle should look? I haven’t worked with xpc services before so I don’t know how they work.
I've started my project using https://github.com/rderik/XPCSquirrel as a template. The resulting app folder looks like this:
$ tree MyApp.app
MyApp.app/
└── Contents
├── Info.plist
├── MacOS
│ └── MyApp
└── XPCServices
└── ServiceProvider.xpc
└── Contents
├── Info.plist
└── MacOS
└── ServiceProvider
Happy to provide more information if you need it.
Thanks, that should be enough info for now 👍
Once I've gotten very basic iOS support working (a sponsor wants that) I'll try implementing support for XPC services. Basic iOS support isn't too far away so you shouldn't have to wait too long :)
I'm finally working on Swift Bundler again after not really working on it much at all for probably over 6 months. The early access version currently has support for expressing any possible plist entries in the configuration file. I will be merging the early access version into this repo soon after a few more improvements. After that I'll be looking into supporting a big chunk of the kinds of Apple-specific app content that Xcode supports (iMessage extensions, XPC services, etc.)