The Mac App Store guidelines require “launch at login” functionality to be enabled in response to a user action. Your app will be rejected if you set the state to true by default.
FAQ
How is this different from the old package?
This is a new repo as the old package had a lot of bloat in its Git history. I also took the opportunity to make a more minimal API optimized for SwiftUI apps.
LaunchAtLogin (Modern)
This package is meant for apps targeting macOS 13 or later. If you need backwards-compatibility, check out the old
LaunchAtLogin
package.Requirements
macOS 13+
Install
Add
https://github.com/sindresorhus/LaunchAtLogin-Modern
in the “Swift Package Manager” tab in Xcode.Usage
Put the toggle in your
Settings
scene. That’s it.The
LaunchAtLogin.Toggle
view works similarly to the built-inToggle
except that is has a predefined binding and label.The default label is
"Launch at login"
, but it can be overridden:You can also access the state directly:
Note
The Mac App Store guidelines require “launch at login” functionality to be enabled in response to a user action. Your app will be rejected if you set the state to true by default.
FAQ
How is this different from the old package?
This is a new repo as the old package had a lot of bloat in its Git history. I also took the opportunity to make a more minimal API optimized for SwiftUI apps.
Related