LoginItemKit
A simple Swift package to add non-sandboxed macOS applications to user login items.
Overview
There are basically two ways to achieve launch at login functionality on macOS.
Let's compare LoginItemKit to the popular LaunchAtLogin package.
| LaunchAtLogin | LoginItemKit | |
|---|---|---|
| Framework | ServiceManagement | LaunchServices |
| Deprecated | Partly (10.10) | Yes (10.11) |
| Sandbox support | Yes | No |
| SwiftPM support | No | Yes |
| Needs helper app & build script | Yes | No |
| Shows up in system preferences | No | Yes |
So feel free to use this package in all your non-sandboxed apps and let's hope that Apple does not remove the LaunchServices API from future versions of macOS.
Installation
SwiftPM
.package(url: "https://github.com/chrenn/LoginItemKit", from: "1.0.0")Usage
import LoginItemKit
print(LoginItemKit.launchAtLogin)
// → false
LoginItemKit.launchAtLogin = true
print(LoginItemKit.launchAtLogin)
// → true