├── README.md ├── System Preferences.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── jordansinger.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── jordansinger.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── System Preferences ├── Assets.xcassets ├── AccentColor.colorset │ └── Contents.json ├── AppIcon.appiconset │ └── Contents.json └── Contents.json ├── ContentView.swift ├── Info.plist ├── Preview Content └── Preview Assets.xcassets │ └── Contents.json ├── System_Preferences.entitlements └── System_PreferencesApp.swift /README.md: -------------------------------------------------------------------------------- 1 | System Preferences macOS SwiftUI example 2 | ![Preferences](https://user-images.githubusercontent.com/110813/88483174-1cffda00-cf34-11ea-90b3-60271eb5a0e2.png) 3 | -------------------------------------------------------------------------------- /System Preferences.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 86A37FCB24A93112009CF340 /* System_PreferencesApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86A37FCA24A93112009CF340 /* System_PreferencesApp.swift */; }; 11 | 86A37FCD24A93112009CF340 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86A37FCC24A93112009CF340 /* ContentView.swift */; }; 12 | 86A37FCF24A93114009CF340 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 86A37FCE24A93114009CF340 /* Assets.xcassets */; }; 13 | 86A37FD224A93114009CF340 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 86A37FD124A93114009CF340 /* Preview Assets.xcassets */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | 86A37FC724A93112009CF340 /* System Preferences.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "System Preferences.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | 86A37FCA24A93112009CF340 /* System_PreferencesApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = System_PreferencesApp.swift; sourceTree = ""; }; 19 | 86A37FCC24A93112009CF340 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 20 | 86A37FCE24A93114009CF340 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 21 | 86A37FD124A93114009CF340 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 22 | 86A37FD324A93114009CF340 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | 86A37FD424A93114009CF340 /* System_Preferences.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = System_Preferences.entitlements; sourceTree = ""; }; 24 | /* End PBXFileReference section */ 25 | 26 | /* Begin PBXFrameworksBuildPhase section */ 27 | 86A37FC424A93112009CF340 /* Frameworks */ = { 28 | isa = PBXFrameworksBuildPhase; 29 | buildActionMask = 2147483647; 30 | files = ( 31 | ); 32 | runOnlyForDeploymentPostprocessing = 0; 33 | }; 34 | /* End PBXFrameworksBuildPhase section */ 35 | 36 | /* Begin PBXGroup section */ 37 | 86A37FBE24A93112009CF340 = { 38 | isa = PBXGroup; 39 | children = ( 40 | 86A37FC924A93112009CF340 /* System Preferences */, 41 | 86A37FC824A93112009CF340 /* Products */, 42 | ); 43 | sourceTree = ""; 44 | }; 45 | 86A37FC824A93112009CF340 /* Products */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | 86A37FC724A93112009CF340 /* System Preferences.app */, 49 | ); 50 | name = Products; 51 | sourceTree = ""; 52 | }; 53 | 86A37FC924A93112009CF340 /* System Preferences */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 86A37FCA24A93112009CF340 /* System_PreferencesApp.swift */, 57 | 86A37FCC24A93112009CF340 /* ContentView.swift */, 58 | 86A37FCE24A93114009CF340 /* Assets.xcassets */, 59 | 86A37FD324A93114009CF340 /* Info.plist */, 60 | 86A37FD424A93114009CF340 /* System_Preferences.entitlements */, 61 | 86A37FD024A93114009CF340 /* Preview Content */, 62 | ); 63 | path = "System Preferences"; 64 | sourceTree = ""; 65 | }; 66 | 86A37FD024A93114009CF340 /* Preview Content */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 86A37FD124A93114009CF340 /* Preview Assets.xcassets */, 70 | ); 71 | path = "Preview Content"; 72 | sourceTree = ""; 73 | }; 74 | /* End PBXGroup section */ 75 | 76 | /* Begin PBXNativeTarget section */ 77 | 86A37FC624A93112009CF340 /* System Preferences */ = { 78 | isa = PBXNativeTarget; 79 | buildConfigurationList = 86A37FD724A93114009CF340 /* Build configuration list for PBXNativeTarget "System Preferences" */; 80 | buildPhases = ( 81 | 86A37FC324A93112009CF340 /* Sources */, 82 | 86A37FC424A93112009CF340 /* Frameworks */, 83 | 86A37FC524A93112009CF340 /* Resources */, 84 | ); 85 | buildRules = ( 86 | ); 87 | dependencies = ( 88 | ); 89 | name = "System Preferences"; 90 | productName = "System Preferences"; 91 | productReference = 86A37FC724A93112009CF340 /* System Preferences.app */; 92 | productType = "com.apple.product-type.application"; 93 | }; 94 | /* End PBXNativeTarget section */ 95 | 96 | /* Begin PBXProject section */ 97 | 86A37FBF24A93112009CF340 /* Project object */ = { 98 | isa = PBXProject; 99 | attributes = { 100 | LastSwiftUpdateCheck = 1200; 101 | LastUpgradeCheck = 1200; 102 | TargetAttributes = { 103 | 86A37FC624A93112009CF340 = { 104 | CreatedOnToolsVersion = 12.0; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = 86A37FC224A93112009CF340 /* Build configuration list for PBXProject "System Preferences" */; 109 | compatibilityVersion = "Xcode 9.3"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = 86A37FBE24A93112009CF340; 117 | productRefGroup = 86A37FC824A93112009CF340 /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | 86A37FC624A93112009CF340 /* System Preferences */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | 86A37FC524A93112009CF340 /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | 86A37FD224A93114009CF340 /* Preview Assets.xcassets in Resources */, 132 | 86A37FCF24A93114009CF340 /* Assets.xcassets in Resources */, 133 | ); 134 | runOnlyForDeploymentPostprocessing = 0; 135 | }; 136 | /* End PBXResourcesBuildPhase section */ 137 | 138 | /* Begin PBXSourcesBuildPhase section */ 139 | 86A37FC324A93112009CF340 /* Sources */ = { 140 | isa = PBXSourcesBuildPhase; 141 | buildActionMask = 2147483647; 142 | files = ( 143 | 86A37FCD24A93112009CF340 /* ContentView.swift in Sources */, 144 | 86A37FCB24A93112009CF340 /* System_PreferencesApp.swift in Sources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXSourcesBuildPhase section */ 149 | 150 | /* Begin XCBuildConfiguration section */ 151 | 86A37FD524A93114009CF340 /* Debug */ = { 152 | isa = XCBuildConfiguration; 153 | buildSettings = { 154 | ALWAYS_SEARCH_USER_PATHS = NO; 155 | CLANG_ANALYZER_NONNULL = YES; 156 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 157 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 158 | CLANG_CXX_LIBRARY = "libc++"; 159 | CLANG_ENABLE_MODULES = YES; 160 | CLANG_ENABLE_OBJC_ARC = YES; 161 | CLANG_ENABLE_OBJC_WEAK = YES; 162 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 163 | CLANG_WARN_BOOL_CONVERSION = YES; 164 | CLANG_WARN_COMMA = YES; 165 | CLANG_WARN_CONSTANT_CONVERSION = YES; 166 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 167 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 168 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 169 | CLANG_WARN_EMPTY_BODY = YES; 170 | CLANG_WARN_ENUM_CONVERSION = YES; 171 | CLANG_WARN_INFINITE_RECURSION = YES; 172 | CLANG_WARN_INT_CONVERSION = YES; 173 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 174 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 175 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 176 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 177 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 178 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 179 | CLANG_WARN_STRICT_PROTOTYPES = YES; 180 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 181 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 182 | CLANG_WARN_UNREACHABLE_CODE = YES; 183 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 184 | COPY_PHASE_STRIP = NO; 185 | DEBUG_INFORMATION_FORMAT = dwarf; 186 | ENABLE_STRICT_OBJC_MSGSEND = YES; 187 | ENABLE_TESTABILITY = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu11; 189 | GCC_DYNAMIC_NO_PIC = NO; 190 | GCC_NO_COMMON_BLOCKS = YES; 191 | GCC_OPTIMIZATION_LEVEL = 0; 192 | GCC_PREPROCESSOR_DEFINITIONS = ( 193 | "DEBUG=1", 194 | "$(inherited)", 195 | ); 196 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 197 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 198 | GCC_WARN_UNDECLARED_SELECTOR = YES; 199 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 200 | GCC_WARN_UNUSED_FUNCTION = YES; 201 | GCC_WARN_UNUSED_VARIABLE = YES; 202 | MACOSX_DEPLOYMENT_TARGET = 10.16; 203 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 204 | MTL_FAST_MATH = YES; 205 | ONLY_ACTIVE_ARCH = YES; 206 | SDKROOT = macosx; 207 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 208 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 209 | }; 210 | name = Debug; 211 | }; 212 | 86A37FD624A93114009CF340 /* Release */ = { 213 | isa = XCBuildConfiguration; 214 | buildSettings = { 215 | ALWAYS_SEARCH_USER_PATHS = NO; 216 | CLANG_ANALYZER_NONNULL = YES; 217 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 218 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 219 | CLANG_CXX_LIBRARY = "libc++"; 220 | CLANG_ENABLE_MODULES = YES; 221 | CLANG_ENABLE_OBJC_ARC = YES; 222 | CLANG_ENABLE_OBJC_WEAK = YES; 223 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 224 | CLANG_WARN_BOOL_CONVERSION = YES; 225 | CLANG_WARN_COMMA = YES; 226 | CLANG_WARN_CONSTANT_CONVERSION = YES; 227 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 228 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 229 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 230 | CLANG_WARN_EMPTY_BODY = YES; 231 | CLANG_WARN_ENUM_CONVERSION = YES; 232 | CLANG_WARN_INFINITE_RECURSION = YES; 233 | CLANG_WARN_INT_CONVERSION = YES; 234 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 235 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 236 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 237 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 238 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 239 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 240 | CLANG_WARN_STRICT_PROTOTYPES = YES; 241 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 242 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 243 | CLANG_WARN_UNREACHABLE_CODE = YES; 244 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 245 | COPY_PHASE_STRIP = NO; 246 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 247 | ENABLE_NS_ASSERTIONS = NO; 248 | ENABLE_STRICT_OBJC_MSGSEND = YES; 249 | GCC_C_LANGUAGE_STANDARD = gnu11; 250 | GCC_NO_COMMON_BLOCKS = YES; 251 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 252 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 253 | GCC_WARN_UNDECLARED_SELECTOR = YES; 254 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 255 | GCC_WARN_UNUSED_FUNCTION = YES; 256 | GCC_WARN_UNUSED_VARIABLE = YES; 257 | MACOSX_DEPLOYMENT_TARGET = 10.16; 258 | MTL_ENABLE_DEBUG_INFO = NO; 259 | MTL_FAST_MATH = YES; 260 | SDKROOT = macosx; 261 | SWIFT_COMPILATION_MODE = wholemodule; 262 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 263 | }; 264 | name = Release; 265 | }; 266 | 86A37FD824A93114009CF340 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 270 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 271 | CODE_SIGN_ENTITLEMENTS = "System Preferences/System_Preferences.entitlements"; 272 | CODE_SIGN_STYLE = Automatic; 273 | COMBINE_HIDPI_IMAGES = YES; 274 | DEVELOPMENT_ASSET_PATHS = "\"System Preferences/Preview Content\""; 275 | ENABLE_PREVIEWS = YES; 276 | INFOPLIST_FILE = "System Preferences/Info.plist"; 277 | LD_RUNPATH_SEARCH_PATHS = ( 278 | "$(inherited)", 279 | "@executable_path/../Frameworks", 280 | ); 281 | MACOSX_DEPLOYMENT_TARGET = 10.16; 282 | PRODUCT_BUNDLE_IDENTIFIER = "example.System-Preferences"; 283 | PRODUCT_NAME = "$(TARGET_NAME)"; 284 | SWIFT_VERSION = 5.0; 285 | }; 286 | name = Debug; 287 | }; 288 | 86A37FD924A93114009CF340 /* Release */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 293 | CODE_SIGN_ENTITLEMENTS = "System Preferences/System_Preferences.entitlements"; 294 | CODE_SIGN_STYLE = Automatic; 295 | COMBINE_HIDPI_IMAGES = YES; 296 | DEVELOPMENT_ASSET_PATHS = "\"System Preferences/Preview Content\""; 297 | ENABLE_PREVIEWS = YES; 298 | INFOPLIST_FILE = "System Preferences/Info.plist"; 299 | LD_RUNPATH_SEARCH_PATHS = ( 300 | "$(inherited)", 301 | "@executable_path/../Frameworks", 302 | ); 303 | MACOSX_DEPLOYMENT_TARGET = 10.16; 304 | PRODUCT_BUNDLE_IDENTIFIER = "example.System-Preferences"; 305 | PRODUCT_NAME = "$(TARGET_NAME)"; 306 | SWIFT_VERSION = 5.0; 307 | }; 308 | name = Release; 309 | }; 310 | /* End XCBuildConfiguration section */ 311 | 312 | /* Begin XCConfigurationList section */ 313 | 86A37FC224A93112009CF340 /* Build configuration list for PBXProject "System Preferences" */ = { 314 | isa = XCConfigurationList; 315 | buildConfigurations = ( 316 | 86A37FD524A93114009CF340 /* Debug */, 317 | 86A37FD624A93114009CF340 /* Release */, 318 | ); 319 | defaultConfigurationIsVisible = 0; 320 | defaultConfigurationName = Release; 321 | }; 322 | 86A37FD724A93114009CF340 /* Build configuration list for PBXNativeTarget "System Preferences" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | 86A37FD824A93114009CF340 /* Debug */, 326 | 86A37FD924A93114009CF340 /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | /* End XCConfigurationList section */ 332 | }; 333 | rootObject = 86A37FBF24A93112009CF340 /* Project object */; 334 | } 335 | -------------------------------------------------------------------------------- /System Preferences.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /System Preferences.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /System Preferences.xcodeproj/project.xcworkspace/xcuserdata/jordansinger.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jordansinger/sytemprefs-swiftui-sample/1c7c89c8791fd1f0a695012712a181f5df0c4e72/System Preferences.xcodeproj/project.xcworkspace/xcuserdata/jordansinger.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /System Preferences.xcodeproj/xcuserdata/jordansinger.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | System Preferences.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /System Preferences/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /System Preferences/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /System Preferences/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /System Preferences/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // System Preferences 4 | // 5 | // Created by Jordan Singer on 6/28/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | VStack(spacing: 0) { 13 | HStack { 14 | User(name: "Jordan Singer") 15 | Spacer() 16 | Setting(title: "Family Sharing", icon: "person.3.fill") 17 | } 18 | .padding(.horizontal, 32) 19 | .padding(.vertical, 16) 20 | 21 | Divider().background(Color(NSColor.separatorColor)) 22 | 23 | VStack(spacing: 16) { 24 | HStack(alignment: .top) { 25 | Spacer() 26 | Group { 27 | Setting(title: "General", icon: "menubar.dock.rectangle", color: NSColor.systemGreen) 28 | Spacer() 29 | Setting(title: "Desktop & Screen Saver", icon: "desktopcomputer", color: NSColor.systemBlue) 30 | Spacer() 31 | Setting(title: "Dock & Menu Bar", icon: "dock.rectangle") 32 | Spacer() 33 | Setting(title: "Mission Control", icon: "macwindow.on.rectangle", color: NSColor.systemPurple) 34 | } 35 | Spacer() 36 | } 37 | 38 | HStack(alignment: .top) { 39 | Spacer() 40 | Group { 41 | Setting(title: "Touch ID", icon: "touchid", color: NSColor.systemPink) 42 | Spacer() 43 | Setting(title: "Users & Groups", icon: "person.2.fill") 44 | Spacer() 45 | Setting(title: "Wallet", icon: "creditcard", color: NSColor.systemOrange) 46 | Spacer() 47 | Setting(title: "Notifs", icon: "bell.fill", color: NSColor.systemPink) 48 | } 49 | Spacer() 50 | } 51 | } 52 | .padding(.vertical, 24) 53 | .background(Color(NSColor.windowBackgroundColor)) 54 | 55 | Divider().background(Color(NSColor.separatorColor)) 56 | 57 | VStack(spacing: 16) { 58 | HStack { 59 | Spacer() 60 | Group { 61 | Setting(title: "Update", icon: "gear") 62 | Spacer() 63 | Setting(title: "Network", icon: "network", color: NSColor.systemBlue) 64 | Spacer() 65 | Setting(title: "Sound", icon: "speaker.wave.2.fill") 66 | Spacer() 67 | Setting(title: "Battery", icon: "battery.100", color: NSColor.systemGreen) 68 | } 69 | Spacer() 70 | } 71 | 72 | HStack { 73 | Spacer() 74 | Group { 75 | Setting(title: "Keyboard", icon: "keyboard") 76 | Spacer() 77 | Setting(title: "Printer", icon: "printer.fill") 78 | Spacer() 79 | Setting(title: "Displays", icon: "display", color: NSColor.systemBlue) 80 | Spacer() 81 | Setting(title: "Date & Time", icon: "calendar.badge.clock", color: NSColor.systemRed) 82 | } 83 | Spacer() 84 | } 85 | } 86 | .padding(.vertical, 24) 87 | 88 | Spacer() 89 | } 90 | .frame(maxWidth: .infinity, maxHeight: .infinity) 91 | .navigationTitle("System Preferences") 92 | .toolbar { 93 | ToolbarItem(placement: .navigation) { 94 | Button(action: { }) { 95 | Image(systemName: "chevron.left") 96 | } 97 | } 98 | 99 | ToolbarItem(placement: .navigation) { 100 | Button(action: { }) { 101 | Image(systemName: "chevron.right") 102 | } 103 | } 104 | 105 | ToolbarItem(placement: .navigation) { 106 | Button(action: { }) { 107 | Image(systemName: "square.grid.4x3.fill") 108 | } 109 | } 110 | 111 | ToolbarItem(placement: .status) { 112 | Button(action: { }) { 113 | Image(systemName: "magnifyingglass") 114 | } 115 | } 116 | } 117 | } 118 | } 119 | 120 | struct User: View { 121 | @State var name: String 122 | 123 | var body: some View { 124 | HStack(spacing: 12) { 125 | Image(systemName: "person.crop.circle.fill") 126 | .font(.system(size: 64)) 127 | .foregroundColor(Color(NSColor.systemGray)) 128 | 129 | VStack(alignment: .leading, spacing: 2) { 130 | Text(name).font(.title2) 131 | Text("Apple ID, iCloud, Media & App Store").font(.subheadline) 132 | } 133 | } 134 | } 135 | } 136 | 137 | struct Setting: View { 138 | @State var title: String 139 | @State var icon: String 140 | @State var color: NSColor = NSColor.darkGray 141 | 142 | var body: some View { 143 | VStack(spacing: 8) { 144 | Image(systemName: icon) 145 | .font(.system(size: 32)) 146 | .foregroundColor(Color(color)) 147 | 148 | Text(title) 149 | .font(.system(.callout)) 150 | .foregroundColor(Color(NSColor.gray)) 151 | .multilineTextAlignment(.center) 152 | .fixedSize(horizontal: false, vertical: true) 153 | .lineLimit(2) 154 | } 155 | .frame(width: 64) 156 | } 157 | } 158 | 159 | struct ContentView_Previews: PreviewProvider { 160 | static var previews: some View { 161 | ContentView() 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /System Preferences/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSMinimumSystemVersion 22 | $(MACOSX_DEPLOYMENT_TARGET) 23 | 24 | 25 | -------------------------------------------------------------------------------- /System Preferences/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /System Preferences/System_Preferences.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /System Preferences/System_PreferencesApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // System_PreferencesApp.swift 3 | // System Preferences 4 | // 5 | // Created by Jordan Singer on 6/28/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct System_PreferencesApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | --------------------------------------------------------------------------------