{"id":13794596,"url":"https://github.com/sindresorhus/LaunchAtLogin-Modern","last_synced_at":"2025-05-12T21:31:48.677Z","repository":{"id":63140960,"uuid":"565501357","full_name":"sindresorhus/LaunchAtLogin-Modern","owner":"sindresorhus","description":"Add “Launch at Login” functionality to your macOS app in seconds","archived":false,"fork":false,"pushed_at":"2024-01-11T20:35:45.000Z","size":7,"stargazers_count":475,"open_issues_count":2,"forks_count":27,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-11T18:34:13.680Z","etag":null,"topics":["macos","swift","swift-package","swiftui","swiftui-components"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2022-11-13T16:00:10.000Z","updated_at":"2025-05-10T18:31:09.000Z","dependencies_parsed_at":"2024-01-15T10:22:49.520Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/LaunchAtLogin-Modern","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"a04ec1c363be3627734f6dad757d82f5d4fa8fcc"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FLaunchAtLogin-Modern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FLaunchAtLogin-Modern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FLaunchAtLogin-Modern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FLaunchAtLogin-Modern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/LaunchAtLogin-Modern/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253825136,"owners_count":21970138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["macos","swift","swift-package","swiftui","swiftui-components"],"created_at":"2024-08-03T23:00:44.365Z","updated_at":"2025-05-12T21:31:48.601Z","avatar_url":"https://github.com/sindresorhus.png","language":"Swift","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Swift"],"sub_categories":[],"readme":"# LaunchAtLogin\n\n\u003e Add “Launch at Login” functionality to your macOS app in seconds\n\nThis package is meant for apps targeting macOS 13 or later. If you need backwards-compatibility, check out the old [`LaunchAtLogin` package](https://github.com/sindresorhus/LaunchAtLogin).\n\n## Requirements\n\nmacOS 13+\n\n## Install\n\nAdd `https://github.com/sindresorhus/LaunchAtLogin-Modern` in the [“Swift Package Manager” tab in Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).\n\n## Usage\n\nPut the toggle in your `Settings` scene. That's it.\n\n```swift\nimport SwiftUI\nimport LaunchAtLogin\n\n@main\nstruct MyApp: App {\n\tvar body: some Scene {\n\t\tSettings {\n\t\t\tForm {\n\t\t\t\tLaunchAtLogin.Toggle()\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\nThe `LaunchAtLogin.Toggle` view works similarly to the built-in `Toggle` except that is has a predefined binding and label.\n\nThe default label is `\"Launch at login\"`, but it can be overridden:\n\n```swift\nimport SwiftUI\nimport LaunchAtLogin\n\nstruct SettingsScreen: View {\n\tvar body: some View {\n\t\tLaunchAtLogin.Toggle(\"Launch at login 🦄\")\n\n\t\t// Or\n\t\tLaunchAtLogin.Toggle {\n\t\t\tText(\"Launch at login 🦄\")\n\t\t}\n\t}\n}\n```\n\nYou can also access the state directly:\n\n```swift\nimport LaunchAtLogin\n\nprint(LaunchAtLogin.isEnabled)\n//=\u003e false\n\nLaunchAtLogin.isEnabled = true\n\nprint(LaunchAtLogin.isEnabled)\n//=\u003e true\n```\n\n## Note\n\nThe [Mac App Store guidelines](https://developer.apple.com/app-store/review/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.\n\n## FAQ\n\n### How is this different from the old package?\n\nThis 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.\n\n## Related\n\n- [Defaults](https://github.com/sindresorhus/Defaults) - Swifty and modern UserDefaults\n- [KeyboardShortcuts](https://github.com/sindresorhus/KeyboardShortcuts) - Add user-customizable global keyboard shortcuts to your macOS app\n- [DockProgress](https://github.com/sindresorhus/DockProgress) - Show progress in your app's Dock icon\n- [More…](https://github.com/search?q=user%3Asindresorhus+language%3Aswift+archived%3Afalse\u0026type=repositories)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2FLaunchAtLogin-Modern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2FLaunchAtLogin-Modern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2FLaunchAtLogin-Modern/lists"}