From e5a3bc8a33306647e5bdbe883284094cfca2b914 Mon Sep 17 00:00:00 2001 From: vitalii p Date: Sat, 21 Oct 2023 20:57:59 +0300 Subject: [PATCH] added library and example project --- .../contents.xcworkspacedata | 7 + Example/Example.xcodeproj/project.pbxproj | 369 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 58 +++ Example/Example/Assets.xcassets/Contents.json | 6 + Example/Example/ContentView.swift | 181 +++++++++ Example/Example/Example.entitlements | 10 + Example/Example/ExampleApp.swift | 18 + .../Preview Assets.xcassets/Contents.json | 6 + Package.swift | 25 ++ README.md | 67 +++- Source/SystemSettingsAccessibility.swift | 74 ++++ Source/SystemSettingsBattery.swift | 26 ++ Source/SystemSettingsControlCenter.swift | 80 ++++ Source/SystemSettingsDesktopDock.swift | 41 ++ Source/SystemSettingsDisplays.swift | 47 +++ Source/SystemSettingsGeneral.swift | 54 +++ Source/SystemSettingsKeyboard.swift | 53 +++ Source/SystemSettingsLockScreen.swift | 35 ++ Source/SystemSettingsMain.swift | 148 +++++++ Source/SystemSettingsNetwork.swift | 89 +++++ Source/SystemSettingsProtocol.swift | 53 +++ Source/SystemSettingsScreenTime.swift | 44 +++ Source/SystemSettingsSecurityPrivacy.swift | 132 +++++++ Source/SystemSettingsSharing.swift | 61 +++ Source/SystemSettingsSiri.swift | 26 ++ Source/SystemSettingsTouchIDPassword.swift | 26 ++ Source/SystemSettingsWiFi.swift | 29 ++ .../SystemSettingsAccessTests.swift | 12 + 31 files changed, 1802 insertions(+), 1 deletion(-) create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 Example/Example.xcodeproj/project.pbxproj create mode 100644 Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Example/Example/Assets.xcassets/Contents.json create mode 100644 Example/Example/ContentView.swift create mode 100644 Example/Example/Example.entitlements create mode 100644 Example/Example/ExampleApp.swift create mode 100644 Example/Example/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 Package.swift create mode 100644 Source/SystemSettingsAccessibility.swift create mode 100644 Source/SystemSettingsBattery.swift create mode 100644 Source/SystemSettingsControlCenter.swift create mode 100644 Source/SystemSettingsDesktopDock.swift create mode 100644 Source/SystemSettingsDisplays.swift create mode 100644 Source/SystemSettingsGeneral.swift create mode 100644 Source/SystemSettingsKeyboard.swift create mode 100644 Source/SystemSettingsLockScreen.swift create mode 100644 Source/SystemSettingsMain.swift create mode 100644 Source/SystemSettingsNetwork.swift create mode 100644 Source/SystemSettingsProtocol.swift create mode 100644 Source/SystemSettingsScreenTime.swift create mode 100644 Source/SystemSettingsSecurityPrivacy.swift create mode 100644 Source/SystemSettingsSharing.swift create mode 100644 Source/SystemSettingsSiri.swift create mode 100644 Source/SystemSettingsTouchIDPassword.swift create mode 100644 Source/SystemSettingsWiFi.swift create mode 100644 Tests/SystemSettingsAccessTests/SystemSettingsAccessTests.swift diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj new file mode 100644 index 0000000..175fd26 --- /dev/null +++ b/Example/Example.xcodeproj/project.pbxproj @@ -0,0 +1,369 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 60; + objects = { + +/* Begin PBXBuildFile section */ + A5FD59D12ADDB5DE008503D3 /* ExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FD59D02ADDB5DE008503D3 /* ExampleApp.swift */; }; + A5FD59D32ADDB5DE008503D3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FD59D22ADDB5DE008503D3 /* ContentView.swift */; }; + A5FD59D52ADDB5DF008503D3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5FD59D42ADDB5DF008503D3 /* Assets.xcassets */; }; + A5FD59D82ADDB5DF008503D3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5FD59D72ADDB5DF008503D3 /* Preview Assets.xcassets */; }; + A5FD59E12ADDB62B008503D3 /* SystemSettingsAccess in Frameworks */ = {isa = PBXBuildFile; productRef = A5FD59E02ADDB62B008503D3 /* SystemSettingsAccess */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + A5FD59CD2ADDB5DE008503D3 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A5FD59D02ADDB5DE008503D3 /* ExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleApp.swift; sourceTree = ""; }; + A5FD59D22ADDB5DE008503D3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + A5FD59D42ADDB5DF008503D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A5FD59D72ADDB5DF008503D3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + A5FD59D92ADDB5DF008503D3 /* Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Example.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A5FD59CA2ADDB5DE008503D3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A5FD59E12ADDB62B008503D3 /* SystemSettingsAccess in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A5FD59C42ADDB5DE008503D3 = { + isa = PBXGroup; + children = ( + A5FD59CF2ADDB5DE008503D3 /* Example */, + A5FD59CE2ADDB5DE008503D3 /* Products */, + ); + sourceTree = ""; + }; + A5FD59CE2ADDB5DE008503D3 /* Products */ = { + isa = PBXGroup; + children = ( + A5FD59CD2ADDB5DE008503D3 /* Example.app */, + ); + name = Products; + sourceTree = ""; + }; + A5FD59CF2ADDB5DE008503D3 /* Example */ = { + isa = PBXGroup; + children = ( + A5FD59D02ADDB5DE008503D3 /* ExampleApp.swift */, + A5FD59D22ADDB5DE008503D3 /* ContentView.swift */, + A5FD59D42ADDB5DF008503D3 /* Assets.xcassets */, + A5FD59D92ADDB5DF008503D3 /* Example.entitlements */, + A5FD59D62ADDB5DF008503D3 /* Preview Content */, + ); + path = Example; + sourceTree = ""; + }; + A5FD59D62ADDB5DF008503D3 /* Preview Content */ = { + isa = PBXGroup; + children = ( + A5FD59D72ADDB5DF008503D3 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A5FD59CC2ADDB5DE008503D3 /* Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = A5FD59DC2ADDB5DF008503D3 /* Build configuration list for PBXNativeTarget "Example" */; + buildPhases = ( + A5FD59C92ADDB5DE008503D3 /* Sources */, + A5FD59CA2ADDB5DE008503D3 /* Frameworks */, + A5FD59CB2ADDB5DE008503D3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Example; + packageProductDependencies = ( + A5FD59E02ADDB62B008503D3 /* SystemSettingsAccess */, + ); + productName = Example; + productReference = A5FD59CD2ADDB5DE008503D3 /* Example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A5FD59C52ADDB5DE008503D3 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1500; + ORGANIZATIONNAME = "IGR Soft"; + TargetAttributes = { + A5FD59CC2ADDB5DE008503D3 = { + CreatedOnToolsVersion = 15.0; + }; + }; + }; + buildConfigurationList = A5FD59C82ADDB5DE008503D3 /* Build configuration list for PBXProject "Example" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = A5FD59C42ADDB5DE008503D3; + packageReferences = ( + A5FD59DF2ADDB62B008503D3 /* XCLocalSwiftPackageReference ".." */, + ); + productRefGroup = A5FD59CE2ADDB5DE008503D3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A5FD59CC2ADDB5DE008503D3 /* Example */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A5FD59CB2ADDB5DE008503D3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A5FD59D82ADDB5DF008503D3 /* Preview Assets.xcassets in Resources */, + A5FD59D52ADDB5DF008503D3 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A5FD59C92ADDB5DE008503D3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A5FD59D32ADDB5DE008503D3 /* ContentView.swift in Sources */, + A5FD59D12ADDB5DE008503D3 /* ExampleApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + A5FD59DA2ADDB5DF008503D3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + A5FD59DB2ADDB5DF008503D3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + }; + name = Release; + }; + A5FD59DD2ADDB5DF008503D3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Example/Example.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\""; + DEVELOPMENT_TEAM = DMP42GVPJ3; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.igrsoft.Example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + A5FD59DE2ADDB5DF008503D3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = Example/Example.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\""; + DEVELOPMENT_TEAM = DMP42GVPJ3; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.igrsoft.Example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A5FD59C82ADDB5DE008503D3 /* Build configuration list for PBXProject "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A5FD59DA2ADDB5DF008503D3 /* Debug */, + A5FD59DB2ADDB5DF008503D3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A5FD59DC2ADDB5DF008503D3 /* Build configuration list for PBXNativeTarget "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A5FD59DD2ADDB5DF008503D3 /* Debug */, + A5FD59DE2ADDB5DF008503D3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + A5FD59DF2ADDB62B008503D3 /* XCLocalSwiftPackageReference ".." */ = { + isa = XCLocalSwiftPackageReference; + relativePath = ..; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + A5FD59E02ADDB62B008503D3 /* SystemSettingsAccess */ = { + isa = XCSwiftPackageProductDependency; + productName = SystemSettingsAccess; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = A5FD59C52ADDB5DE008503D3 /* Project object */; +} diff --git a/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json b/Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..3f00db4 --- /dev/null +++ b/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Assets.xcassets/Contents.json b/Example/Example/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/Example/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/ContentView.swift b/Example/Example/ContentView.swift new file mode 100644 index 0000000..7e180d0 --- /dev/null +++ b/Example/Example/ContentView.swift @@ -0,0 +1,181 @@ +// +// ContentView.swift +// Example +// +// Created by Vitalii P on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import SwiftUI +import SystemSettingsAccess + +struct ContentView: View { + var body: some View { + ScrollView { + Text("SystemSettingsMain") + ForEach(SystemSettingsMain.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsGeneral") + ForEach(SystemSettingsGeneral.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsAccessibility") + ForEach(SystemSettingsAccessibility.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsSharing") + ForEach(SystemSettingsSharing.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsSecurityPrivacy") + ForEach(SystemSettingsSecurityPrivacy.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsWiFi") + ForEach(SystemSettingsWiFi.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsScreenTime") + ForEach(SystemSettingsScreenTime.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsControlCenter") + ForEach(SystemSettingsControlCenter.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsSiri") + ForEach(SystemSettingsSiri.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsDesktopDock") + ForEach(SystemSettingsDesktopDock.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsDisplays") + ForEach(SystemSettingsDisplays.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsBattery") + ForEach(SystemSettingsBattery.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsLockScreen") + ForEach(SystemSettingsLockScreen.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsTouchIDPassword") + ForEach(SystemSettingsTouchIDPassword.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsKeyboard") + ForEach(SystemSettingsKeyboard.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + + Text("SystemSettingsNetwork") + ForEach(SystemSettingsNetwork.allCases, id: \.self) { item in + Button(action: { + _ = item.open() + }, label: { + Text(String(describing: item)) + }) + } + Spacer(minLength: 32) + } + .padding() + } +} + +#Preview { + ContentView() +} diff --git a/Example/Example/Example.entitlements b/Example/Example/Example.entitlements new file mode 100644 index 0000000..18aff0c --- /dev/null +++ b/Example/Example/Example.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Example/Example/ExampleApp.swift b/Example/Example/ExampleApp.swift new file mode 100644 index 0000000..5978743 --- /dev/null +++ b/Example/Example/ExampleApp.swift @@ -0,0 +1,18 @@ +// +// ExampleApp.swift +// Example +// +// Created by Vitalii P on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import SwiftUI + +@main +struct ExampleApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/Example/Example/Preview Content/Preview Assets.xcassets/Contents.json b/Example/Example/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/Example/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..f5372b3 --- /dev/null +++ b/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SystemSettingsAccess", + platforms: [.macOS(.v13)], + products: [ + // Products define the executables and libraries a package produces, making them visible to other packages. + .library( + name: "SystemSettingsAccess", + targets: ["SystemSettingsAccess"]), + ], + targets: [ + // Targets are the basic building blocks of a package, defining a module or a test suite. + // Targets can depend on other targets in this package and products from dependencies. + .target( + name: "SystemSettingsAccess", path: "Source"), + .testTarget( + name: "SystemSettingsAccessTests", + dependencies: ["SystemSettingsAccess"]), + ], + swiftLanguageVersions: [.v5] +) diff --git a/README.md b/README.md index 43266c6..a932954 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,67 @@ # SystemSettingsAccess -Pathes to open some page of System Settings +Paths to open some page of System Settings + +### List of Settings: +- SystemSettingsMain +- SystemSettingsGeneral +- SystemSettingsAccessibility +- SystemSettingsBattery +- SystemSettingsControlCenter +- SystemSettingsDesktopDock +- SystemSettingsDisplays +- SystemSettingsKeyboard +- SystemSettingsLockScreen +- SystemSettingsNetwork +- SystemSettingsScreenTime +- SystemSettingsSecurityPrivacy +- SystemSettingsSharing +- SystemSettingsSiri +- SystemSettingsTouchIDPassword +- SystemSettingsWiFi + +### Protocol: +- SystemSettingsProtocol + +``` +// A protocol for interacting with system settings. +public protocol SystemSettingsProtocol: RawRepresentable where RawValue == String { + + // The URL path to the system settings. + var path: URL? { get } + + // Opens the system settings using the specified identifier. + // + // - Returns: true if the settings were successfully opened; otherwise, false. + func open() -> Bool +} +``` + +### Usage: + +``` +SystemSettingsMain.appleID.path +``` +returns: "x-apple.systempreferences:com.apple.preferences.AppleIDPrefPane" + +``` +SystemSettingsMain.appleID.open() +``` +Opens the Apple ID preferences + +## Installation + +### Swift Package Manager + +The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. + +Once you have your Swift package set up, adding SystemSettingsAccess as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. + +```swift +dependencies: [ + .package(url: "https://github.com/IGRSoft/SystemSettingsAccess.git", .upToNextMajor(from: "1.0.0")) +] +``` + +## License + +SystemSettingsAccess is released under the MIT license. [See LICENSE](https://github.com/IGRSoft/SystemSettingsAccess/blob/master/LICENSE) for details. \ No newline at end of file diff --git a/Source/SystemSettingsAccessibility.swift b/Source/SystemSettingsAccessibility.swift new file mode 100644 index 0000000..f7b4454 --- /dev/null +++ b/Source/SystemSettingsAccessibility.swift @@ -0,0 +1,74 @@ +// +// SystemSettingsAccessibility.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +/// An enumeration representing various accessibility settings with their associated identifiers. +public enum SystemSettingsAccessibility: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Accessibility-Settings.extension?" + } + + /// Represents the VoiceOver preferences. + case voiceOver = "Seeing_VoiceOver" + + /// Represents the Zoom preferences. + case zoom = "Zoom" + + /// Represents the Display preferences. + case display = "Seeing_Display" + + /// Represents the Display Spoken Content preferences. + case spokenContent = "SpokenContent" + + /// Represents the Media Descriptions preferences. + case descriptions = "Descriptions" + + + + /// Represents the Audio preferences. + case audio = "Audio" + + /// Represents the RTT preferences. + case rtt = "RTT" + + /// Represents the Captioning preferences. + case captions = "Captioning" + + + + /// Represents the Voice Control preferences. + case voiceControl = "VoiceControl" + + /// Represents the Keyboard preferences. + case keyboard = "Keyboard" + + /// Represents the Pointer Control preferences. + case mouse = "Mouse" + + /// Represents the Switch Control preferences. + case `switch` = "Switch" + + + + /// Represents the Live Speech preferences. + case liveSpeech = "LiveSpeech" + + /// Represents the Personal Voice preferences. + case personalVoice = "PersonalVoice" + + + + /// Represents the Siri preferences. + case siri = "Siri" + + /// Represents the Shortcut preferences. + case shortcut = "Shortcut" +} diff --git a/Source/SystemSettingsBattery.swift b/Source/SystemSettingsBattery.swift new file mode 100644 index 0000000..bd34095 --- /dev/null +++ b/Source/SystemSettingsBattery.swift @@ -0,0 +1,26 @@ +// +// SystemSettingsBattery.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsBattery: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Battery-Settings.extension?" + } + + /// Represents the Battery Health preferences. + case batteryHealth = "batteryhealth" + + /// Represents the Current Source preferences. + case currentSource = "currentSource" + + /// Represents the Options preferences. + case options = "options" +} diff --git a/Source/SystemSettingsControlCenter.swift b/Source/SystemSettingsControlCenter.swift new file mode 100644 index 0000000..831e783 --- /dev/null +++ b/Source/SystemSettingsControlCenter.swift @@ -0,0 +1,80 @@ +// +// SystemSettingsControlCenter.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsControlCenter: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.ControlCenter-Settings.extension?" + } + + /// Represents the Wi-Fi preferences. + case wifi = "WiFi" + + /// Represents the Bluetooth preferences. + case bluetooth = "Bluetooth" + + /// Represents the AirDrop preferences. + case airDrop = "AirDrop" + + /// Represents the Focus preferences. + case focus = "FocusModes" + + /// Represents the Stage Manager preferences. + case stageManager = "StageManager" + + /// Represents the Screen Mirroring preferences. + case screenMirroring = "ScreenMirroring" + + /// Represents the Display preferences. + case display = "Display" + + /// Represents the Sound preferences. + case sound = "Sound" + + /// Represents the Now Playing preferences. + case nowPlaying = "NowPlaying" + + /// Represents the Accessibility Shortcuts preferences. + case accessibilityShortcuts = "AccessibilityShortcuts" + + /// Represents the Battery preferences. + case battery = "Battery" + + /// Represents the Hearing preferences. + case hearing = "Hearing" + + /// Represents the Fast User Switcher preferences. + case fastUserSwitcher = "UserSwitcher" + + /// Represents the Keyboard Brightness preferences. + case keyboardBrightness = "KeyboardBrightness" + + /// Represents the Menu Bar preferences. + case menuBar = "MenuBar" + + /// Represents the Clock Options preferences. + case clock = "Clock" + + /// Represents the Spotlight preferences. + case spotlight = "Spotlight" + + /// Represents the Siri preferences. + case siri = "Siri" + + /// Represents the Time Machine preferences. + case timeMachine = "TimeMachine" + + /// Represents the Do Not Disturb preferences. + case doNotDisturb = "DoNotDisturb" + + /// Represents the VPN preferences. + case vpn = "VPN" +} diff --git a/Source/SystemSettingsDesktopDock.swift b/Source/SystemSettingsDesktopDock.swift new file mode 100644 index 0000000..5823109 --- /dev/null +++ b/Source/SystemSettingsDesktopDock.swift @@ -0,0 +1,41 @@ +// +// SystemSettingsDesktopDock.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsDesktopDock: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Desktop-Settings.extension?" + } + + /// Represents the Dock preferences. + case dock = "Dock" + + /// Represents the Desktop preferences. + case desktop = "Desktop" + + /// Represents the Widgets preferences. + case widgets = "Widgets" + + /// Represents the Widgets preferences. + case windows = "Windows" + + /// Represents the Mission Control preferences. + case missionControl = "MissionControl" + + /// Represents the Shortcuts preferences. + case shortcuts = "Shortcuts" + + /// Represents the Hot Corners preferences. + case hotCorners = "HotCorners" + + /// Represents the Applications preferences. + case applications = "Applications" +} diff --git a/Source/SystemSettingsDisplays.swift b/Source/SystemSettingsDisplays.swift new file mode 100644 index 0000000..5e3366e --- /dev/null +++ b/Source/SystemSettingsDisplays.swift @@ -0,0 +1,47 @@ +// +// SystemSettingsDisplays.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsDisplays: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Displays-Settings.extension?" + } + + /// Represents the Ambience Section preferences. + case ambienceSection = "ambienceSection" + + /// Represents the Arrangement Section preferences. + case arrangementSection = "arrangementSection" + + /// Represents the Characteristic Section preferences. + case characteristicSection = "characteristicSection" + + /// Represents the Displays Section preferences. + case displaysSection = "displaysSection" + + /// Represents the Miscellaneous Section preferences. + case miscellaneousSection = "miscellaneousSection" + + /// Represents the Profile Section preferences. + case profileSection = "profileSection" + + /// Represents the Resolution Section preferences. + case resolutionSection = "resolutionSection" + + /// Represents the Sidecar Section preferences. + case sidecarSection = "sidecarSection" + + /// Represents the Advanced preferences. + case hotCorners = "advancedSection" + + /// Represents the Night Shift preferences. + case nightShift = "nightShiftSection" +} diff --git a/Source/SystemSettingsGeneral.swift b/Source/SystemSettingsGeneral.swift new file mode 100644 index 0000000..8e7c93e --- /dev/null +++ b/Source/SystemSettingsGeneral.swift @@ -0,0 +1,54 @@ +// +// SystemSettingsGeneral.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsGeneral: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple." + } + + /// Represents the About preferences. + case about = "SystemProfiler.AboutExtension" + + /// Represents the Software Update preferences. + case softwareUpdate = "Software-Update-Settings.extension" + + /// Represents the Storage preferences. + case storage = "settings.Storage" + + /// Represents the AirDrop Handoff preferences. + case airDropHandoff = "AirDrop-Handoff-Settings.extension" + + /// Represents the Login Items preferences. + case loginItems = "LoginItems-Settings.extension" + + + + /// Represents the Language & Region preferences. + case languageRegion = "Localization-Settings.extension" + + /// Represents the Date & Time preferences. + case dateTime = "Date-Time-Settings.extension" + + + + /// Represents the Sharing preferences. + case sharing = "Sharing-Settings.extension" + + /// Represents the Time Machine preferences. + case timeMachine = "Time-Machine-Settings.extension" + + /// Represents the Transfer & Reset preferences. + case transferReset = "Transfer-Reset-Settings.extension" + + /// Represents the Startup-Disk preferences. + case startupDisk = "Startup-Disk-Settings.extension" +} diff --git a/Source/SystemSettingsKeyboard.swift b/Source/SystemSettingsKeyboard.swift new file mode 100644 index 0000000..d8fd7b3 --- /dev/null +++ b/Source/SystemSettingsKeyboard.swift @@ -0,0 +1,53 @@ +// +// SystemSettingsKeyboard.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsKeyboard: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Keyboard-Settings.extension?" + } + + /// Represents Keyboard Shortcuts -> Function keys preferences. + case functionKeys = "FunctionKeys" + + /// Represents the Keyboard Shortcuts -> Modifier keys preferences. + case shortcuts = "Shortcuts" + + /// Represents Keyboard Shortcuts -> Modifier keys preferences. + case customizeModifierKeys = "CustomizeModifierKeys" + + /// Represents the Keyboard Shortcuts -> Modifier keys preferences. + case modifierKeys = "ModifierKeys" + + /// Represents the Input Sources preferences. + case inputSources = "InputSources" + + /// Represents the Input Sources -> Caps Lock Input Section preferences. + case capsLockInputSources = "CapsLockInputSources" + + /// Represents the Input Sources -> Spelling preferences. + case spelling = "Spelling" + + /// Represents the Input Sources -> Unknown preferences. + case languageInputMethods = "LanguageInputMethods" + + /// Represents the Input Sources -> Smart Quotes preferences. + case useSmartQuotes = "UseSmartQuotes" + + /// Represents the TextReplacements preferences. + case textReplacements = "TextReplacements" + + /// Represents the preferences. + case touchBarSettings = "TouchBarSettings" + + /// Represents the Connection List preferences. + case dictation = "Dictation" +} diff --git a/Source/SystemSettingsLockScreen.swift b/Source/SystemSettingsLockScreen.swift new file mode 100644 index 0000000..d0ac01f --- /dev/null +++ b/Source/SystemSettingsLockScreen.swift @@ -0,0 +1,35 @@ +// +// SystemSettingsLockScreen.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsLockScreen: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Lock-Screen-Settings.extension?" + } + + /// Represents the Screen Saver preferences. + case screenSaver = "ScreenSaver" + + /// Represents the Password preferences. + case password = "Password" + + /// Represents the Display Off preferences. + case displayOff = "DisplayOff" + + /// Represents Large Clock preferences. + case largeClock = "LargeClock" + + /// Represents the LockScreen Message preferences. + case lockScreenMessage = "LockScreenMessage" + + /// Represents the Login Window preferences. + case loginWindow = "LoginWindow" +} diff --git a/Source/SystemSettingsMain.swift b/Source/SystemSettingsMain.swift new file mode 100644 index 0000000..5a0fa21 --- /dev/null +++ b/Source/SystemSettingsMain.swift @@ -0,0 +1,148 @@ +// +// SystemSettingsDefault.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +/// An enumeration representing various system settings with their associated identifiers. +public enum SystemSettingsMain: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple." + } + + /// Represents the Apple ID preferences. + case appleID = "preferences.AppleIDPrefPane" + + /// Represents the Apple ID preferences. + case family = "Family-Settings.extension" + + + + /// Represents the UNKNOWN FollowUp preferences. + case follow = "FollowUpSettings.FollowUpSettingsExtension" + + + + /// Represents the Wi-Fi preferences. + case wifi = "wifi-settings-extension" + + /// Represents the Bluetooth preferences. + case bluetooth = "BluetoothSettings" + + /// Represents the Network preferences. + case network = "Network-Settings.extension" + + /// Represents the UNKNOWN Classroom preferences. + case classroom = "ClassroomSettings" + + /// Represents the Notifications preferences. + case notifications = "Notifications-Settings.extension" + + + /// Represents the Sound preferences. + case sound = "Sound-Settings.extension" + + /// Represents the Focus preferences. + case focus = "Focus-Settings.extension" + + /// Represents the Screen Time preferences. + case screenTime = "Screen-Time-Settings.extension" + + + + /// Represents the General preferences. + case general = "systempreferences.GeneralSettings" + + /// Represents the Appearance preferences. + case appearance = "Appearance-Settings.extension" + + /// Represents the Accessibility preferences. + case accessibility = "Accessibility-Settings.extension" + + /// Represents the Control Center preferences. + case controlCenter = "ControlCenter-Settings.extension" + + /// Represents the Siri & Spotlight preferences. + case siri = "Siri-Settings.extension" + + /// Represents the Siri & Spotlight preferences. + case spotlight = "Spotlight-Settings.extension" + + + + /// Represents the Spotlight preferences. + case privacySecurity = "settings.PrivacySecurity.extension" + + + + /// Represents the Desktop & Dock preferences. + case desktopDock = "Desktop-Settings.extension" + + /// Represents the Displays preferences. + case displays = "Displays-Settings.extension" + + /// Represents the Wallpaper preferences. + case wallpaper = "Wallpaper-Settings.extension" + + /// Represents the Screen Saver preferences. + case screenSaver = "ScreenSaver-Settings.extension" + + /// Represents the Battery preferences. + case battery = "Battery-Settings.extension" + + + + /// Represents the Lock Screen preferences. + case lockScreen = "Lock-Screen-Settings.extension" + + /// Represents the Touch-ID preferences. + case touchID = "Touch-ID-Settings.extension" + + /// Represents the Users-Groups preferences. + case usersGroups = "Users-Groups-Settings.extension" + + + + /// Represents the Password preferences. + case password = "Passwords-Settings.extension" + + /// Represents the Internet Accounts preferences. + case internetAccounts = "Internet-Accounts-Settings.extension" + + /// Represents the Game-Center preferences. + case gameCenter = "Game-Center-Settings.extension" + + /// Represents the Wallet & Apple Pay preferences. + case walletApplePay = "WalletSettingsExtension" + + + + /// Represents the Keyboard preferences. + case keyboard = "Keyboard-Settings.extension" + + /// Represents the Mouse preferences. + case mouse = "Mouse-Settings.extension" + + /// Represents the Trackpad preferences. + case trackpad = "Trackpad-Settings.extension" + + /// Represents the Game Controller preferences. + case gameController = "Game-Controller-Settings.extension" + + /// Represents the CD DVD preferences. + case cd = "CD-DVD-Settings.extension" + + /// Represents the Printer Scanner preferences. + case printerScanner = "Print-Scan-Settings.extension" + + + + /// Represents the ClassKit preferences. + case classKit = "preferences.ClassKitPreferencePane" +} diff --git a/Source/SystemSettingsNetwork.swift b/Source/SystemSettingsNetwork.swift new file mode 100644 index 0000000..468c101 --- /dev/null +++ b/Source/SystemSettingsNetwork.swift @@ -0,0 +1,89 @@ +// +// SystemSettingsNetwork.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsNetwork: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Network-Settings.extension?" + } + + /// Represents the Wi-Fi details preferences. + case wifi = "Advanced Wi-Fi" + + /// Represents the Firewall preferences. + case firewall = "Firewall" + + /// Represents the Current Connection -> Details -> 802.1X preferences. + case wifi802_1X = "802.1X" + + /// Represents the Current Connection -> Details -> TCP/IP preferences. + case tcpIP = "TCP/IP" + + /// Represents the Current Connection -> Details -> DNS preferences. + case dns = "DNS" + + /// Represents the Current Connection -> Details -> WINS preferences. + case wins = "WINS" + + /// Represents the Current Connection -> Details -> Proxies preferences. + case proxies = "Proxies" + + /// Represents the Bluetooth preferences. + case bluetooth = "Bluetooth" + + /// Represents the Ethernet preferences. + case ethernet = "Ethernet" + + /// Represents the Ethernet Details -> Hardware preferences. + case ethernetDetails = "Advanced Ethernet" + + /// Represents the Modem preferences. + case modem = "Modem" + + /// Represents the Modem Details preferences. + case modemDetails = "Advanced Modem" + + /// Represents the Thunderbolt preferences. + case thunderbolt = "Thunderbolt" + + /// Represents the Network preferences. + case network = "Network" + + /// Represents the VPN preferences. + case vpn = "VPN" + + /// Represents the Advanced VPN preferences. + case vpnDetails = "Advanced VPN" + + /// Represents the VPN on Demand preferences. + case vpnOnDemand = "VPN on Demand" + + /// Represents the WWAN preferences. + case wwan = "WWAN" + + /// Represents the 6to4 preferences. + case sixTo4 = "6to4" + + /// Represents the PPPoE preferences. + case pppOe = "PPPoE" + + /// Represents the Bond preferences. + case bond = "Bond" + + /// Represents the PPP preferences. + case ppp = "PPP" + + /// Represents the VLAN preferences. + case vlan = "VLAN" + + /// Represents the Manage Virtual Interfaces preferences. + case virtualInterfaces = "VirtualInterfaces" +} diff --git a/Source/SystemSettingsProtocol.swift b/Source/SystemSettingsProtocol.swift new file mode 100644 index 0000000..254dbc7 --- /dev/null +++ b/Source/SystemSettingsProtocol.swift @@ -0,0 +1,53 @@ +// +// SystemSettingsProtocol.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import AppKit + +fileprivate enum SystemPreferences: String, CaseIterable { + + /// The system preferences key for the "General" preferences. + case general = "x-apple.systempreferences" +} + +internal protocol InternalSystemSettingsProtocol { + var domain: String { get } +} + +/// A protocol for interacting with system settings. +public protocol SystemSettingsProtocol: RawRepresentable where RawValue == String { + + /// The URL path to the system settings. + var path: URL? { get } + + /// Opens the system settings using the specified identifier. + /// + /// - Returns: `true` if the settings were successfully opened; otherwise, `false`. + func open() -> Bool +} + +/// An extension to the `SystemSettingsProtocol` providing default implementations. +extension SystemSettingsProtocol { + + /// The URL path to the system settings. + public var path: URL? { + guard let internalSelf = self as? InternalSystemSettingsProtocol else { + return nil + } + + return URL(string: [SystemPreferences.general.rawValue, (internalSelf.domain + rawValue)].joined(separator: ":")) + } + + /// Opens the system settings using the specified identifier. + public func open() -> Bool { + guard let url = path else { + return false + } + + return NSWorkspace.shared.open(url) + } +} diff --git a/Source/SystemSettingsScreenTime.swift b/Source/SystemSettingsScreenTime.swift new file mode 100644 index 0000000..1e22b54 --- /dev/null +++ b/Source/SystemSettingsScreenTime.swift @@ -0,0 +1,44 @@ +// +// SystemSettingsScreenTime.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsScreenTime: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Accessibility-Settings.extension?" + } + + /// Represents the Always Allowed preferences. + case alwaysAllowed = "path=always-allowed" + + /// Represents Applications Limits preferences. + case appLimits = "path=app-limits" + + /// Represents the Usage Statistic preferences. + case usage = "path=usage" + + /// Represents the Communication Limits preferences. + case communicationLimits = "path=communication-limits" + + /// Represents the Content And Privacy preferences. + case contentAndPrivacy = "path=content-and-privacy" + + /// Represents the Downtime preferences. + case downtime = "path=downtime" + + /// Represents the Notifications preferences. + case notifications = "path=notifications" + + /// Represents the Pickups preferences. + case pickups = "path=pickups" + + /// Represents the Requests List preferences. + case requests = "path=requests" +} diff --git a/Source/SystemSettingsSecurityPrivacy.swift b/Source/SystemSettingsSecurityPrivacy.swift new file mode 100644 index 0000000..ff14a0b --- /dev/null +++ b/Source/SystemSettingsSecurityPrivacy.swift @@ -0,0 +1,132 @@ +// +// SystemSettingsSecurityPrivacy.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +/// An enumeration representing security and privacy settings with their associated identifiers. +public enum SystemSettingsSecurityPrivacy: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.settings.PrivacySecurity.extension?" + } + + /// Represents the Location Services settings. + case locationServices = "Privacy_LocationServices" + + /// Represents the Location Services preferences. + case locationSystemServices = "Privacy_SystemServices" + + /// Represents the Contacts preferences. + case contacts = "Privacy_Contacts" + + /// Represents the Calendars preferences. + case calendars = "Privacy_Calendars" + + /// Represents the Reminders preferences. + case reminders = "Privacy_Reminders" + + /// Represents the Photos preferences. + case photos = "Privacy_Photos" + + /// Represents the Bluetooth preferences. + case bluetooth = "Privacy_Bluetooth" + + /// Represents the Microphone preferences. + case microphone = "Privacy_Microphone" + + /// Represents the Camera preferences. + case camera = "Privacy_Camera" + + /// Represents the Motion & Fitness preferences. + case motionFitness = "Privacy_Motion" + + /// Represents the HomeKit settings. + case homeKit = "Privacy_HomeKit" + + /// Represents the Speech Recognition preferences. + case speechRecognition = "Privacy_SpeechRecognition" + + /// Represents the Media & Apple Music preferences. + case mediaAppleMusic = "Privacy_Media" + + /// Represents the Files and Folders preferences. + case filesAndFolders = "Privacy_FilesAndFolders" + + /// Represents the Full Disk preferences. + case fullDiskAccess = "Privacy_AllFiles" + + /// Represents the Focus preferences. + case focus = "Privacy_Focus" + + /// Represents the Accessibility preferences. + case accessibility = "Privacy_Accessibility" + + /// Represents the Input Monitoring preferences. + case inputMonitoring = "Privacy_ListenEvent" + + /// Represents the Screen Recording preferences. + case screenRecording = "Privacy_ScreenCapture" + + /// Represents the Passkeys Access and Web Browsers preferences. + case passkeysWebBrowser = "Privacy_PasskeyAccess" + + /// Represents Automation preferences. + case automation = "Privacy_Automation" + + /// Represents the App Management preferences. + case appManagement = "Privacy_AppBundles" + + /// Represents the Developer Tools preferences. + case developerTools = "Privacy_DevTools" + + + + /// Represents the Sensitive Content Warning preferences. + case sensitiveContentWarning = "Privacy_NudityDetection" + + + + /// Represents the Analytics & Improvements preferences. + case analyticsImprovements = "Privacy_Analytics" + + /// Represents the Apple Advertising preferences. + case advertising = "Privacy_Advertising" + + + + /// Represents the Security preferences. + case security = "Security" + + + + /// Represents the FileVault preferences. + case fileVault = "FileVault" + + /// Represents the Lockdown Mode preferences. + case lockdown = "LockdownMode" + + + + /// Represents the Advanced preferences. + case advanced = "Advanced" +} + +public enum SystemSettingsSecurityPrivacyProfile: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple." + } + + /// Represents the Extensions Profiles preferences. + case extensions = "ExtensionsPreferences" + + /// Represents the Profiles preferences. + case profile = "Profiles-Settings.extension" +} diff --git a/Source/SystemSettingsSharing.swift b/Source/SystemSettingsSharing.swift new file mode 100644 index 0000000..096755d --- /dev/null +++ b/Source/SystemSettingsSharing.swift @@ -0,0 +1,61 @@ +// +// SystemSettingsSharing.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +/// An enumeration representing various sharing settings with their associated identifiers. +public enum SystemSettingsSharing: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Sharing-Settings.extension?" + } + + /// Represents the Personal File Sharing preferences. + case file = "Services_PersonalFileSharing" + + /// Represents the Media Sharing preferences. + case media = "Services_MediaSharing" + + /// Represents the Screen Sharing preferences. + case screen = "Services_ScreenSharing" + + /// Represents the Content Caching preferences. + case contentCaching = "Services_ContentCaching" + + /// Represents the Windows Sharing preferences. + case windows = "Services_WindowsSharing" + + /// Represents the CD/DVD Sharing preferences. + case cd = "Services_DVDorCDSharing" + + + + /// Represents the Bluetooth Sharing preferences. + case bluetooth = "Services_BluetoothSharing" + + /// Represents the Printer Sharing preferences. + case print = "Services_PrinterSharing" + + /// Represents the Internet Sharing preferences. + case internet = "Internet" + + + + /// Represents the Remote Management (Apple Remote Desktop) preferences. + case remoteManagement = "Services_ARDService" + + /// Represents the Remote Login sharing preferences. + case remoteLogin = "Services_RemoteLogin" + + /// Represents the Remote Application Scripting sharing preferences. + case remoteAppleEvents = "Services_RemoteAppleEvent" + + /// Represents the Remote Login Sharing preferences. + case host = "Hostname" +} diff --git a/Source/SystemSettingsSiri.swift b/Source/SystemSettingsSiri.swift new file mode 100644 index 0000000..54016f4 --- /dev/null +++ b/Source/SystemSettingsSiri.swift @@ -0,0 +1,26 @@ +// +// SystemSettingsSiri.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsSiri: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Siri-Settings.extension?" + } + + /// Represents the Siri preferences. + case siri = "Siri" + + /// Represents the Privacy preferences. + case privacy = "privacy" + + /// Represents the Search Results preferences. + case searchResults = "searchResults" +} diff --git a/Source/SystemSettingsTouchIDPassword.swift b/Source/SystemSettingsTouchIDPassword.swift new file mode 100644 index 0000000..dfdaca8 --- /dev/null +++ b/Source/SystemSettingsTouchIDPassword.swift @@ -0,0 +1,26 @@ +// +// SystemSettingsTouchIDPassword.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsTouchIDPassword: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.Touch-ID-Settings.extension?" + } + + /// Represents the Password Section preferences. + case password = "Password" + + /// Represents the Touch ID Section preferences. + case touchID = "TouchID" + + /// Represents the Watch Section preferences. + case watch = "Watch" +} diff --git a/Source/SystemSettingsWiFi.swift b/Source/SystemSettingsWiFi.swift new file mode 100644 index 0000000..e5ffc23 --- /dev/null +++ b/Source/SystemSettingsWiFi.swift @@ -0,0 +1,29 @@ +// +// SystemSettingsWiFi.swift +// SystemSettingsAccess +// +// Created by Vitalii Parovishnyk on 16.10.2023. +// Copyright © 2023 IGR Soft. All rights reserved. +// + +import Foundation + +public enum SystemSettingsWiFi: String, SystemSettingsProtocol, InternalSystemSettingsProtocol, CaseIterable { + + /// InternalSystemSettingsProtocol + internal var domain: String { + "com.apple.wifi-settings-extension?" + } + + /// Represents the Advanced preferences. + case advanced = "Advanced" + + /// Represents current Connection Details preferences. + case details = "General_Details" + + /// Represents the Connection List preferences. + case join = "General_Join" + + /// Represents UNKNOWN preferences. + case main = "General_Main" +} diff --git a/Tests/SystemSettingsAccessTests/SystemSettingsAccessTests.swift b/Tests/SystemSettingsAccessTests/SystemSettingsAccessTests.swift new file mode 100644 index 0000000..58ce21a --- /dev/null +++ b/Tests/SystemSettingsAccessTests/SystemSettingsAccessTests.swift @@ -0,0 +1,12 @@ +import XCTest +@testable import SystemSettingsAccess + +final class SystemSettingsAccessTests: XCTestCase { + func testExample() throws { + // XCTest Documentation + // https://developer.apple.com/documentation/xctest + + // Defining Test Cases and Test Methods + // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods + } +}