├── Control Center.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── jordansinger.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── jordansinger.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Control Center ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── ContentView.swift ├── Control_Center.entitlements ├── Control_CenterApp.swift ├── Info.plist └── Preview Content │ └── Preview Assets.xcassets │ └── Contents.json └── README.md /Control Center.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 86A37FE724A95DD5009CF340 /* Control_CenterApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86A37FE624A95DD5009CF340 /* Control_CenterApp.swift */; }; 11 | 86A37FE924A95DD5009CF340 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86A37FE824A95DD5009CF340 /* ContentView.swift */; }; 12 | 86A37FEB24A95DD7009CF340 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 86A37FEA24A95DD7009CF340 /* Assets.xcassets */; }; 13 | 86A37FEE24A95DD7009CF340 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 86A37FED24A95DD7009CF340 /* Preview Assets.xcassets */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | 86A37FE324A95DD5009CF340 /* Control Center.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Control Center.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | 86A37FE624A95DD5009CF340 /* Control_CenterApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Control_CenterApp.swift; sourceTree = ""; }; 19 | 86A37FE824A95DD5009CF340 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 20 | 86A37FEA24A95DD7009CF340 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 21 | 86A37FED24A95DD7009CF340 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 22 | 86A37FEF24A95DD7009CF340 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | 86A37FF024A95DD7009CF340 /* Control_Center.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Control_Center.entitlements; sourceTree = ""; }; 24 | /* End PBXFileReference section */ 25 | 26 | /* Begin PBXFrameworksBuildPhase section */ 27 | 86A37FE024A95DD5009CF340 /* Frameworks */ = { 28 | isa = PBXFrameworksBuildPhase; 29 | buildActionMask = 2147483647; 30 | files = ( 31 | ); 32 | runOnlyForDeploymentPostprocessing = 0; 33 | }; 34 | /* End PBXFrameworksBuildPhase section */ 35 | 36 | /* Begin PBXGroup section */ 37 | 86A37FDA24A95DD5009CF340 = { 38 | isa = PBXGroup; 39 | children = ( 40 | 86A37FE524A95DD5009CF340 /* Control Center */, 41 | 86A37FE424A95DD5009CF340 /* Products */, 42 | ); 43 | sourceTree = ""; 44 | }; 45 | 86A37FE424A95DD5009CF340 /* Products */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | 86A37FE324A95DD5009CF340 /* Control Center.app */, 49 | ); 50 | name = Products; 51 | sourceTree = ""; 52 | }; 53 | 86A37FE524A95DD5009CF340 /* Control Center */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 86A37FE624A95DD5009CF340 /* Control_CenterApp.swift */, 57 | 86A37FE824A95DD5009CF340 /* ContentView.swift */, 58 | 86A37FEA24A95DD7009CF340 /* Assets.xcassets */, 59 | 86A37FEF24A95DD7009CF340 /* Info.plist */, 60 | 86A37FF024A95DD7009CF340 /* Control_Center.entitlements */, 61 | 86A37FEC24A95DD7009CF340 /* Preview Content */, 62 | ); 63 | path = "Control Center"; 64 | sourceTree = ""; 65 | }; 66 | 86A37FEC24A95DD7009CF340 /* Preview Content */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 86A37FED24A95DD7009CF340 /* Preview Assets.xcassets */, 70 | ); 71 | path = "Preview Content"; 72 | sourceTree = ""; 73 | }; 74 | /* End PBXGroup section */ 75 | 76 | /* Begin PBXNativeTarget section */ 77 | 86A37FE224A95DD5009CF340 /* Control Center */ = { 78 | isa = PBXNativeTarget; 79 | buildConfigurationList = 86A37FF324A95DD7009CF340 /* Build configuration list for PBXNativeTarget "Control Center" */; 80 | buildPhases = ( 81 | 86A37FDF24A95DD5009CF340 /* Sources */, 82 | 86A37FE024A95DD5009CF340 /* Frameworks */, 83 | 86A37FE124A95DD5009CF340 /* Resources */, 84 | ); 85 | buildRules = ( 86 | ); 87 | dependencies = ( 88 | ); 89 | name = "Control Center"; 90 | productName = "Control Center"; 91 | productReference = 86A37FE324A95DD5009CF340 /* Control Center.app */; 92 | productType = "com.apple.product-type.application"; 93 | }; 94 | /* End PBXNativeTarget section */ 95 | 96 | /* Begin PBXProject section */ 97 | 86A37FDB24A95DD5009CF340 /* Project object */ = { 98 | isa = PBXProject; 99 | attributes = { 100 | LastSwiftUpdateCheck = 1200; 101 | LastUpgradeCheck = 1200; 102 | TargetAttributes = { 103 | 86A37FE224A95DD5009CF340 = { 104 | CreatedOnToolsVersion = 12.0; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = 86A37FDE24A95DD5009CF340 /* Build configuration list for PBXProject "Control Center" */; 109 | compatibilityVersion = "Xcode 9.3"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = 86A37FDA24A95DD5009CF340; 117 | productRefGroup = 86A37FE424A95DD5009CF340 /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | 86A37FE224A95DD5009CF340 /* Control Center */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | 86A37FE124A95DD5009CF340 /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | 86A37FEE24A95DD7009CF340 /* Preview Assets.xcassets in Resources */, 132 | 86A37FEB24A95DD7009CF340 /* Assets.xcassets in Resources */, 133 | ); 134 | runOnlyForDeploymentPostprocessing = 0; 135 | }; 136 | /* End PBXResourcesBuildPhase section */ 137 | 138 | /* Begin PBXSourcesBuildPhase section */ 139 | 86A37FDF24A95DD5009CF340 /* Sources */ = { 140 | isa = PBXSourcesBuildPhase; 141 | buildActionMask = 2147483647; 142 | files = ( 143 | 86A37FE924A95DD5009CF340 /* ContentView.swift in Sources */, 144 | 86A37FE724A95DD5009CF340 /* Control_CenterApp.swift in Sources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXSourcesBuildPhase section */ 149 | 150 | /* Begin XCBuildConfiguration section */ 151 | 86A37FF124A95DD7009CF340 /* 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 | 86A37FF224A95DD7009CF340 /* 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 | 86A37FF424A95DD7009CF340 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 270 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 271 | CODE_SIGN_ENTITLEMENTS = "Control Center/Control_Center.entitlements"; 272 | CODE_SIGN_STYLE = Automatic; 273 | COMBINE_HIDPI_IMAGES = YES; 274 | DEVELOPMENT_ASSET_PATHS = "\"Control Center/Preview Content\""; 275 | ENABLE_PREVIEWS = YES; 276 | INFOPLIST_FILE = "Control Center/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.Control-Center"; 283 | PRODUCT_NAME = "$(TARGET_NAME)"; 284 | SWIFT_VERSION = 5.0; 285 | }; 286 | name = Debug; 287 | }; 288 | 86A37FF524A95DD7009CF340 /* Release */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 293 | CODE_SIGN_ENTITLEMENTS = "Control Center/Control_Center.entitlements"; 294 | CODE_SIGN_STYLE = Automatic; 295 | COMBINE_HIDPI_IMAGES = YES; 296 | DEVELOPMENT_ASSET_PATHS = "\"Control Center/Preview Content\""; 297 | ENABLE_PREVIEWS = YES; 298 | INFOPLIST_FILE = "Control Center/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.Control-Center"; 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 | 86A37FDE24A95DD5009CF340 /* Build configuration list for PBXProject "Control Center" */ = { 314 | isa = XCConfigurationList; 315 | buildConfigurations = ( 316 | 86A37FF124A95DD7009CF340 /* Debug */, 317 | 86A37FF224A95DD7009CF340 /* Release */, 318 | ); 319 | defaultConfigurationIsVisible = 0; 320 | defaultConfigurationName = Release; 321 | }; 322 | 86A37FF324A95DD7009CF340 /* Build configuration list for PBXNativeTarget "Control Center" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | 86A37FF424A95DD7009CF340 /* Debug */, 326 | 86A37FF524A95DD7009CF340 /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | /* End XCConfigurationList section */ 332 | }; 333 | rootObject = 86A37FDB24A95DD5009CF340 /* Project object */; 334 | } 335 | -------------------------------------------------------------------------------- /Control Center.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Control Center.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Control Center.xcodeproj/project.xcworkspace/xcuserdata/jordansinger.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jordansinger/controlcenter-swiftui-sample/25a68c727cb475f0b7a452f97a95b4c957f8df19/Control Center.xcodeproj/project.xcworkspace/xcuserdata/jordansinger.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Control Center.xcodeproj/xcuserdata/jordansinger.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Control Center.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Control Center/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 | -------------------------------------------------------------------------------- /Control Center/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 | -------------------------------------------------------------------------------- /Control Center/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Control Center/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // Control Center 4 | // 5 | // Created by Jordan Singer on 6/28/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | @State var volume = 0.0 12 | var body: some View { 13 | ZStack { 14 | EffectsView(material: NSVisualEffectView.Material.popover, blendingMode: NSVisualEffectView.BlendingMode.behindWindow) 15 | 16 | VStack(spacing: 10) { 17 | HStack(spacing: 12) { 18 | VStack(alignment: .leading, spacing: 12) { 19 | Setting(title: "Wi-Fi", subtitle: "Home", image: "wifi") 20 | Setting(title: "Bluetooth", subtitle: "On", image: "airpodspro") 21 | Setting(title: "AirDrop", subtitle: "Contacts Only", image: "dot.radiowaves.right") 22 | } 23 | .modifier(ModulePadding()) 24 | .frame(width: 134, height: 134) 25 | .modifier(Module()) 26 | 27 | VStack(spacing: 10) { 28 | Setting(title: "Do Not Disturb", image: "moon.fill") 29 | .modifier(ModulePadding()) 30 | .modifier(Module()) 31 | 32 | HStack(spacing: 10) { 33 | SmallSetting(title: "Keyboard Brightness", image: "sun.min") 34 | SmallSetting(title: "Airplay Display", image: "airplayvideo") 35 | } 36 | } 37 | .frame(width: 134, height: 134) 38 | } 39 | 40 | VStack(spacing: 10) { 41 | Control(title: "Display", image: "ipad.landscape") 42 | Control(title: "Sound", image: "airplayaudio") 43 | } 44 | } 45 | .padding() 46 | } 47 | .frame(width: 297, height: 305) 48 | } 49 | } 50 | 51 | struct Setting: View { 52 | @State var title: String 53 | @State var subtitle: String? 54 | @State var image: String 55 | 56 | var body: some View { 57 | HStack { 58 | Ellipse() 59 | .foregroundColor(Color(NSColor.systemBlue)) 60 | .overlay( 61 | Image(systemName: image) 62 | .foregroundColor(.white) 63 | ) 64 | .frame(width: 28, height: 28) 65 | 66 | VStack(alignment: .leading) { 67 | Text(title) 68 | .font(.headline) 69 | 70 | if subtitle != nil { 71 | Text(subtitle ?? "") 72 | .font(.subheadline) 73 | .foregroundColor(Color(NSColor.secondaryLabelColor)) 74 | } 75 | } 76 | 77 | Spacer() 78 | } 79 | } 80 | } 81 | 82 | struct SmallSetting: View { 83 | @State var title: String 84 | @State var image: String 85 | 86 | var body: some View { 87 | VStack { 88 | Image(systemName: image) 89 | .font(.system(size: 14, weight: .semibold)) 90 | .foregroundColor(Color(NSColor.secondaryLabelColor)) 91 | Text(title) 92 | .multilineTextAlignment(.center) 93 | .font(.caption) 94 | } 95 | .frame(width: 62, height: 62) 96 | .modifier(Module()) 97 | } 98 | } 99 | 100 | struct Control: View { 101 | @State var title: String 102 | @State var image: String 103 | @State var value = 0.5 104 | 105 | var body: some View { 106 | VStack(alignment: .leading, spacing: 0) { 107 | Text(title) 108 | .font(.headline) 109 | 110 | HStack(spacing: 8) { 111 | Slider(value: $value) 112 | .accentColor(.red) 113 | 114 | Image(systemName: image) 115 | .font(.system(size: 14, weight: .semibold)) 116 | .foregroundColor(Color(NSColor.secondaryLabelColor)) 117 | .frame(width: 28, height: 28) 118 | .background(EffectsView(material: NSVisualEffectView.Material.popover, blendingMode: NSVisualEffectView.BlendingMode.behindWindow)) 119 | .cornerRadius(14) 120 | } 121 | } 122 | .padding(9) 123 | .modifier(Module()) 124 | } 125 | } 126 | 127 | struct Module: ViewModifier { 128 | func body(content: Content) -> some View { 129 | content 130 | .background(EffectsView(material: NSVisualEffectView.Material.popover, blendingMode: NSVisualEffectView.BlendingMode.withinWindow)) 131 | .cornerRadius(10) 132 | } 133 | } 134 | 135 | struct ModulePadding: ViewModifier { 136 | func body(content: Content) -> some View { 137 | content 138 | .padding(.horizontal, 9) 139 | .padding(.vertical, 12) 140 | } 141 | } 142 | 143 | // blur effect 144 | struct EffectsView: NSViewRepresentable { 145 | var material: NSVisualEffectView.Material 146 | var blendingMode: NSVisualEffectView.BlendingMode 147 | 148 | func makeNSView(context: Context) -> NSVisualEffectView { 149 | let visualEffectView = NSVisualEffectView() 150 | visualEffectView.material = material 151 | visualEffectView.blendingMode = blendingMode 152 | visualEffectView.state = NSVisualEffectView.State.active 153 | return visualEffectView 154 | } 155 | 156 | func updateNSView(_ visualEffectView: NSVisualEffectView, context: Context) { 157 | visualEffectView.material = material 158 | visualEffectView.blendingMode = blendingMode 159 | } 160 | } 161 | 162 | struct ContentView_Previews: PreviewProvider { 163 | static var previews: some View { 164 | ContentView() 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /Control Center/Control_Center.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 | -------------------------------------------------------------------------------- /Control Center/Control_CenterApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Control_CenterApp.swift 3 | // Control Center 4 | // 5 | // Created by Jordan Singer on 6/28/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct Control_CenterApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Control Center/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 | -------------------------------------------------------------------------------- /Control Center/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Control Center build in SwiftUI for macOS 2 | ![control](https://user-images.githubusercontent.com/110813/88483192-43be1080-cf34-11ea-8355-c361198cff90.png) 3 | --------------------------------------------------------------------------------