| 1234567891011121314151617181920 |
- import Foundation
- import ServiceManagement
- enum LoginItemManager {
- static var isEnabled: Bool {
- SMAppService.mainApp.status == .enabled
- }
- static func setEnabled(_ enabled: Bool) throws {
- if enabled {
- if SMAppService.mainApp.status != .enabled {
- try SMAppService.mainApp.register()
- }
- } else {
- if SMAppService.mainApp.status == .enabled {
- try SMAppService.mainApp.unregister()
- }
- }
- }
- }
|