├── .github └── FUNDING.yml ├── Demo Sidebar.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ └── chakming.xcuserdatad │ └── UserInterfaceState.xcuserstate ├── LICENSE ├── README.md ├── Shared ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── ContentView.swift ├── SidebarApp.swift └── SidebarView.swift ├── dark.png ├── iOS └── Info.plist ├── light.png └── macOS ├── Info.plist └── macOS.entitlements /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: 1998code 4 | -------------------------------------------------------------------------------- /Demo Sidebar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 44E82DC224D1641000A1741E /* SidebarApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44E82DAF24D1640E00A1741E /* SidebarApp.swift */; }; 11 | 44E82DC324D1641000A1741E /* SidebarApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44E82DAF24D1640E00A1741E /* SidebarApp.swift */; }; 12 | 44E82DC424D1641000A1741E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44E82DB024D1640E00A1741E /* ContentView.swift */; }; 13 | 44E82DC524D1641000A1741E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44E82DB024D1640E00A1741E /* ContentView.swift */; }; 14 | 44E82DC624D1641000A1741E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 44E82DB124D1641000A1741E /* Assets.xcassets */; }; 15 | 44E82DC724D1641000A1741E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 44E82DB124D1641000A1741E /* Assets.xcassets */; }; 16 | 44E82DD124D164AB00A1741E /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44E82DD024D164AB00A1741E /* SidebarView.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 44E82DAF24D1640E00A1741E /* SidebarApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarApp.swift; sourceTree = ""; }; 21 | 44E82DB024D1640E00A1741E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 22 | 44E82DB124D1641000A1741E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 44E82DB624D1641000A1741E /* Demo Sidebar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Demo Sidebar.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 44E82DB924D1641000A1741E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | 44E82DBE24D1641000A1741E /* Demo Sidebar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Demo Sidebar.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | 44E82DC024D1641000A1741E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 44E82DC124D1641000A1741E /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = ""; }; 28 | 44E82DD024D164AB00A1741E /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 44E82DB324D1641000A1741E /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | 44E82DBB24D1641000A1741E /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 44E82DA924D1640E00A1741E = { 50 | isa = PBXGroup; 51 | children = ( 52 | 44E82DAE24D1640E00A1741E /* Shared */, 53 | 44E82DB824D1641000A1741E /* iOS */, 54 | 44E82DBF24D1641000A1741E /* macOS */, 55 | 44E82DB724D1641000A1741E /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | 44E82DAE24D1640E00A1741E /* Shared */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 44E82DAF24D1640E00A1741E /* SidebarApp.swift */, 63 | 44E82DB024D1640E00A1741E /* ContentView.swift */, 64 | 44E82DD024D164AB00A1741E /* SidebarView.swift */, 65 | 44E82DB124D1641000A1741E /* Assets.xcassets */, 66 | ); 67 | path = Shared; 68 | sourceTree = ""; 69 | }; 70 | 44E82DB724D1641000A1741E /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 44E82DB624D1641000A1741E /* Demo Sidebar.app */, 74 | 44E82DBE24D1641000A1741E /* Demo Sidebar.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 44E82DB824D1641000A1741E /* iOS */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 44E82DB924D1641000A1741E /* Info.plist */, 83 | ); 84 | path = iOS; 85 | sourceTree = ""; 86 | }; 87 | 44E82DBF24D1641000A1741E /* macOS */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 44E82DC024D1641000A1741E /* Info.plist */, 91 | 44E82DC124D1641000A1741E /* macOS.entitlements */, 92 | ); 93 | path = macOS; 94 | sourceTree = ""; 95 | }; 96 | /* End PBXGroup section */ 97 | 98 | /* Begin PBXNativeTarget section */ 99 | 44E82DB524D1641000A1741E /* Demo Sidebar (iOS) */ = { 100 | isa = PBXNativeTarget; 101 | buildConfigurationList = 44E82DCA24D1641000A1741E /* Build configuration list for PBXNativeTarget "Demo Sidebar (iOS)" */; 102 | buildPhases = ( 103 | 44E82DB224D1641000A1741E /* Sources */, 104 | 44E82DB324D1641000A1741E /* Frameworks */, 105 | 44E82DB424D1641000A1741E /* Resources */, 106 | ); 107 | buildRules = ( 108 | ); 109 | dependencies = ( 110 | ); 111 | name = "Demo Sidebar (iOS)"; 112 | productName = "Demo Sidebar (iOS)"; 113 | productReference = 44E82DB624D1641000A1741E /* Demo Sidebar.app */; 114 | productType = "com.apple.product-type.application"; 115 | }; 116 | 44E82DBD24D1641000A1741E /* Demo Sidebar (macOS) */ = { 117 | isa = PBXNativeTarget; 118 | buildConfigurationList = 44E82DCD24D1641000A1741E /* Build configuration list for PBXNativeTarget "Demo Sidebar (macOS)" */; 119 | buildPhases = ( 120 | 44E82DBA24D1641000A1741E /* Sources */, 121 | 44E82DBB24D1641000A1741E /* Frameworks */, 122 | 44E82DBC24D1641000A1741E /* Resources */, 123 | ); 124 | buildRules = ( 125 | ); 126 | dependencies = ( 127 | ); 128 | name = "Demo Sidebar (macOS)"; 129 | productName = "Demo Sidebar (macOS)"; 130 | productReference = 44E82DBE24D1641000A1741E /* Demo Sidebar.app */; 131 | productType = "com.apple.product-type.application"; 132 | }; 133 | /* End PBXNativeTarget section */ 134 | 135 | /* Begin PBXProject section */ 136 | 44E82DAA24D1640E00A1741E /* Project object */ = { 137 | isa = PBXProject; 138 | attributes = { 139 | LastSwiftUpdateCheck = 1200; 140 | LastUpgradeCheck = 1200; 141 | TargetAttributes = { 142 | 44E82DB524D1641000A1741E = { 143 | CreatedOnToolsVersion = 12.0; 144 | }; 145 | 44E82DBD24D1641000A1741E = { 146 | CreatedOnToolsVersion = 12.0; 147 | }; 148 | }; 149 | }; 150 | buildConfigurationList = 44E82DAD24D1640E00A1741E /* Build configuration list for PBXProject "Demo Sidebar" */; 151 | compatibilityVersion = "Xcode 9.3"; 152 | developmentRegion = en; 153 | hasScannedForEncodings = 0; 154 | knownRegions = ( 155 | en, 156 | Base, 157 | ); 158 | mainGroup = 44E82DA924D1640E00A1741E; 159 | productRefGroup = 44E82DB724D1641000A1741E /* Products */; 160 | projectDirPath = ""; 161 | projectRoot = ""; 162 | targets = ( 163 | 44E82DB524D1641000A1741E /* Demo Sidebar (iOS) */, 164 | 44E82DBD24D1641000A1741E /* Demo Sidebar (macOS) */, 165 | ); 166 | }; 167 | /* End PBXProject section */ 168 | 169 | /* Begin PBXResourcesBuildPhase section */ 170 | 44E82DB424D1641000A1741E /* Resources */ = { 171 | isa = PBXResourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | 44E82DC624D1641000A1741E /* Assets.xcassets in Resources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | 44E82DBC24D1641000A1741E /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 44E82DC724D1641000A1741E /* Assets.xcassets in Resources */, 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | /* End PBXResourcesBuildPhase section */ 187 | 188 | /* Begin PBXSourcesBuildPhase section */ 189 | 44E82DB224D1641000A1741E /* Sources */ = { 190 | isa = PBXSourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | 44E82DC424D1641000A1741E /* ContentView.swift in Sources */, 194 | 44E82DC224D1641000A1741E /* SidebarApp.swift in Sources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | 44E82DBA24D1641000A1741E /* Sources */ = { 199 | isa = PBXSourcesBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | 44E82DC524D1641000A1741E /* ContentView.swift in Sources */, 203 | 44E82DC324D1641000A1741E /* SidebarApp.swift in Sources */, 204 | 44E82DD124D164AB00A1741E /* SidebarView.swift in Sources */, 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | }; 208 | /* End PBXSourcesBuildPhase section */ 209 | 210 | /* Begin XCBuildConfiguration section */ 211 | 44E82DC824D1641000A1741E /* Debug */ = { 212 | isa = XCBuildConfiguration; 213 | buildSettings = { 214 | ALWAYS_SEARCH_USER_PATHS = NO; 215 | CLANG_ANALYZER_NONNULL = YES; 216 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 217 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 218 | CLANG_CXX_LIBRARY = "libc++"; 219 | CLANG_ENABLE_MODULES = YES; 220 | CLANG_ENABLE_OBJC_ARC = YES; 221 | CLANG_ENABLE_OBJC_WEAK = YES; 222 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 223 | CLANG_WARN_BOOL_CONVERSION = YES; 224 | CLANG_WARN_COMMA = YES; 225 | CLANG_WARN_CONSTANT_CONVERSION = YES; 226 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 227 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 228 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 229 | CLANG_WARN_EMPTY_BODY = YES; 230 | CLANG_WARN_ENUM_CONVERSION = YES; 231 | CLANG_WARN_INFINITE_RECURSION = YES; 232 | CLANG_WARN_INT_CONVERSION = YES; 233 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 234 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 235 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 236 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 237 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 238 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 239 | CLANG_WARN_STRICT_PROTOTYPES = YES; 240 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 241 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 242 | CLANG_WARN_UNREACHABLE_CODE = YES; 243 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 244 | COPY_PHASE_STRIP = NO; 245 | DEBUG_INFORMATION_FORMAT = dwarf; 246 | ENABLE_STRICT_OBJC_MSGSEND = YES; 247 | ENABLE_TESTABILITY = YES; 248 | GCC_C_LANGUAGE_STANDARD = gnu11; 249 | GCC_DYNAMIC_NO_PIC = NO; 250 | GCC_NO_COMMON_BLOCKS = YES; 251 | GCC_OPTIMIZATION_LEVEL = 0; 252 | GCC_PREPROCESSOR_DEFINITIONS = ( 253 | "DEBUG=1", 254 | "$(inherited)", 255 | ); 256 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 257 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 258 | GCC_WARN_UNDECLARED_SELECTOR = YES; 259 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 260 | GCC_WARN_UNUSED_FUNCTION = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 263 | MTL_FAST_MATH = YES; 264 | ONLY_ACTIVE_ARCH = YES; 265 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 266 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 267 | }; 268 | name = Debug; 269 | }; 270 | 44E82DC924D1641000A1741E /* Release */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | ALWAYS_SEARCH_USER_PATHS = NO; 274 | CLANG_ANALYZER_NONNULL = YES; 275 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 276 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 277 | CLANG_CXX_LIBRARY = "libc++"; 278 | CLANG_ENABLE_MODULES = YES; 279 | CLANG_ENABLE_OBJC_ARC = YES; 280 | CLANG_ENABLE_OBJC_WEAK = YES; 281 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 282 | CLANG_WARN_BOOL_CONVERSION = YES; 283 | CLANG_WARN_COMMA = YES; 284 | CLANG_WARN_CONSTANT_CONVERSION = YES; 285 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 286 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 287 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 288 | CLANG_WARN_EMPTY_BODY = YES; 289 | CLANG_WARN_ENUM_CONVERSION = YES; 290 | CLANG_WARN_INFINITE_RECURSION = YES; 291 | CLANG_WARN_INT_CONVERSION = YES; 292 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 293 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 294 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 295 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 296 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 297 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 298 | CLANG_WARN_STRICT_PROTOTYPES = YES; 299 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 300 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 301 | CLANG_WARN_UNREACHABLE_CODE = YES; 302 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 303 | COPY_PHASE_STRIP = NO; 304 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 305 | ENABLE_NS_ASSERTIONS = NO; 306 | ENABLE_STRICT_OBJC_MSGSEND = YES; 307 | GCC_C_LANGUAGE_STANDARD = gnu11; 308 | GCC_NO_COMMON_BLOCKS = YES; 309 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 310 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 311 | GCC_WARN_UNDECLARED_SELECTOR = YES; 312 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 313 | GCC_WARN_UNUSED_FUNCTION = YES; 314 | GCC_WARN_UNUSED_VARIABLE = YES; 315 | MTL_ENABLE_DEBUG_INFO = NO; 316 | MTL_FAST_MATH = YES; 317 | SWIFT_COMPILATION_MODE = wholemodule; 318 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 319 | }; 320 | name = Release; 321 | }; 322 | 44E82DCB24D1641000A1741E /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 326 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 327 | CODE_SIGN_STYLE = Automatic; 328 | ENABLE_PREVIEWS = YES; 329 | INFOPLIST_FILE = iOS/Info.plist; 330 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 331 | LD_RUNPATH_SEARCH_PATHS = ( 332 | "$(inherited)", 333 | "@executable_path/Frameworks", 334 | ); 335 | PRODUCT_BUNDLE_IDENTIFIER = "io.startway.Demo-Sidebar"; 336 | PRODUCT_NAME = "Demo Sidebar"; 337 | SDKROOT = iphoneos; 338 | SWIFT_VERSION = 5.0; 339 | TARGETED_DEVICE_FAMILY = "1,2"; 340 | }; 341 | name = Debug; 342 | }; 343 | 44E82DCC24D1641000A1741E /* Release */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 347 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 348 | CODE_SIGN_STYLE = Automatic; 349 | ENABLE_PREVIEWS = YES; 350 | INFOPLIST_FILE = iOS/Info.plist; 351 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 352 | LD_RUNPATH_SEARCH_PATHS = ( 353 | "$(inherited)", 354 | "@executable_path/Frameworks", 355 | ); 356 | PRODUCT_BUNDLE_IDENTIFIER = "io.startway.Demo-Sidebar"; 357 | PRODUCT_NAME = "Demo Sidebar"; 358 | SDKROOT = iphoneos; 359 | SWIFT_VERSION = 5.0; 360 | TARGETED_DEVICE_FAMILY = "1,2"; 361 | VALIDATE_PRODUCT = YES; 362 | }; 363 | name = Release; 364 | }; 365 | 44E82DCE24D1641000A1741E /* Debug */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 369 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 370 | CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; 371 | CODE_SIGN_STYLE = Automatic; 372 | COMBINE_HIDPI_IMAGES = YES; 373 | ENABLE_PREVIEWS = YES; 374 | INFOPLIST_FILE = macOS/Info.plist; 375 | LD_RUNPATH_SEARCH_PATHS = ( 376 | "$(inherited)", 377 | "@executable_path/../Frameworks", 378 | ); 379 | MACOSX_DEPLOYMENT_TARGET = 11.0; 380 | PRODUCT_BUNDLE_IDENTIFIER = "io.startway.Demo-Sidebar"; 381 | PRODUCT_NAME = "Demo Sidebar"; 382 | SDKROOT = macosx; 383 | SWIFT_VERSION = 5.0; 384 | }; 385 | name = Debug; 386 | }; 387 | 44E82DCF24D1641000A1741E /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 391 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 392 | CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; 393 | CODE_SIGN_STYLE = Automatic; 394 | COMBINE_HIDPI_IMAGES = YES; 395 | ENABLE_PREVIEWS = YES; 396 | INFOPLIST_FILE = macOS/Info.plist; 397 | LD_RUNPATH_SEARCH_PATHS = ( 398 | "$(inherited)", 399 | "@executable_path/../Frameworks", 400 | ); 401 | MACOSX_DEPLOYMENT_TARGET = 11.0; 402 | PRODUCT_BUNDLE_IDENTIFIER = "io.startway.Demo-Sidebar"; 403 | PRODUCT_NAME = "Demo Sidebar"; 404 | SDKROOT = macosx; 405 | SWIFT_VERSION = 5.0; 406 | }; 407 | name = Release; 408 | }; 409 | /* End XCBuildConfiguration section */ 410 | 411 | /* Begin XCConfigurationList section */ 412 | 44E82DAD24D1640E00A1741E /* Build configuration list for PBXProject "Demo Sidebar" */ = { 413 | isa = XCConfigurationList; 414 | buildConfigurations = ( 415 | 44E82DC824D1641000A1741E /* Debug */, 416 | 44E82DC924D1641000A1741E /* Release */, 417 | ); 418 | defaultConfigurationIsVisible = 0; 419 | defaultConfigurationName = Release; 420 | }; 421 | 44E82DCA24D1641000A1741E /* Build configuration list for PBXNativeTarget "Demo Sidebar (iOS)" */ = { 422 | isa = XCConfigurationList; 423 | buildConfigurations = ( 424 | 44E82DCB24D1641000A1741E /* Debug */, 425 | 44E82DCC24D1641000A1741E /* Release */, 426 | ); 427 | defaultConfigurationIsVisible = 0; 428 | defaultConfigurationName = Release; 429 | }; 430 | 44E82DCD24D1641000A1741E /* Build configuration list for PBXNativeTarget "Demo Sidebar (macOS)" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | 44E82DCE24D1641000A1741E /* Debug */, 434 | 44E82DCF24D1641000A1741E /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | defaultConfigurationName = Release; 438 | }; 439 | /* End XCConfigurationList section */ 440 | }; 441 | rootObject = 44E82DAA24D1640E00A1741E /* Project object */; 442 | } 443 | -------------------------------------------------------------------------------- /Demo Sidebar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo Sidebar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demo Sidebar.xcodeproj/project.xcworkspace/xcuserdata/chakming.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1998code/SwiftUI2-MacSidebar/b18296b8977f75275ce512d516a93416a4df2f34/Demo Sidebar.xcodeproj/project.xcworkspace/xcuserdata/chakming.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Ming 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUI2-MacSidebar 2 | A quick demo to build a macOS Application with easy sidebar. 3 | 4 | ## Environment: 5 | Apple macOS 11 Big Sur 6 | 7 | ## Tools : 8 | Xcode 12 beta 3 (Min: Xcode 12 beta 1) 9 | 10 | ## Development : 11 | SwiftUI with multi-platform 12 | 13 | ### Screenshot 14 | 15 | 16 | -------------------------------------------------------------------------------- /Shared/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 | -------------------------------------------------------------------------------- /Shared/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | }, 93 | { 94 | "idiom" : "mac", 95 | "scale" : "1x", 96 | "size" : "16x16" 97 | }, 98 | { 99 | "idiom" : "mac", 100 | "scale" : "2x", 101 | "size" : "16x16" 102 | }, 103 | { 104 | "idiom" : "mac", 105 | "scale" : "1x", 106 | "size" : "32x32" 107 | }, 108 | { 109 | "idiom" : "mac", 110 | "scale" : "2x", 111 | "size" : "32x32" 112 | }, 113 | { 114 | "idiom" : "mac", 115 | "scale" : "1x", 116 | "size" : "128x128" 117 | }, 118 | { 119 | "idiom" : "mac", 120 | "scale" : "2x", 121 | "size" : "128x128" 122 | }, 123 | { 124 | "idiom" : "mac", 125 | "scale" : "1x", 126 | "size" : "256x256" 127 | }, 128 | { 129 | "idiom" : "mac", 130 | "scale" : "2x", 131 | "size" : "256x256" 132 | }, 133 | { 134 | "idiom" : "mac", 135 | "scale" : "1x", 136 | "size" : "512x512" 137 | }, 138 | { 139 | "idiom" : "mac", 140 | "scale" : "2x", 141 | "size" : "512x512" 142 | } 143 | ], 144 | "info" : { 145 | "author" : "xcode", 146 | "version" : 1 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /Shared/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Shared/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // Shared 4 | // 5 | // Created on 29/7/2020. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | VStack { 13 | Text("Hello, world!") 14 | Text("Welcome to SwiftUI 2.").padding() 15 | }.navigationTitle("Explore") 16 | } 17 | } 18 | 19 | struct ContentView_Previews: PreviewProvider { 20 | static var previews: some View { 21 | ContentView() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Shared/SidebarApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Demo_SidebarApp.swift 3 | // Shared 4 | // 5 | // Created on 29/7/2020. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct SidebarApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | #if os(macOS) 15 | SidebarView() 16 | #else 17 | ContentView() 18 | #endif 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Shared/SidebarView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SidebarView.swift 3 | // Demo Sidebar (macOS) 4 | // 5 | // Created on 29/7/2020. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct SidebarView: View { 11 | var body: some View { 12 | NavigationView { 13 | List { 14 | //Caption 15 | Text("Services") 16 | //Navigation links 17 | //Replace "ContentView" with your destination 18 | Group{ 19 | NavigationLink(destination: ContentView()) { 20 | Label("Message", systemImage: "message") 21 | } 22 | NavigationLink(destination: ContentView()) { 23 | Label("Weather", systemImage: "cloud.sun") 24 | } 25 | NavigationLink(destination: ContentView()) { 26 | Label("Charge", systemImage: "bolt.car") 27 | } 28 | NavigationLink(destination: ContentView()) { 29 | Label("HealthCare", systemImage: "pills") 30 | } 31 | NavigationLink(destination: ContentView()) { 32 | Label("Ticket", systemImage: "ticket") 33 | } 34 | NavigationLink(destination: ContentView()) { 35 | Label("Calculator", systemImage: "function") 36 | } 37 | } 38 | //Add some space :) 39 | Spacer() 40 | Text("More") 41 | NavigationLink(destination: ContentView()) { 42 | Label("Shortcut", systemImage: "option") 43 | } 44 | NavigationLink(destination: ContentView()) { 45 | Label("Customize", systemImage: "slider.horizontal.3") 46 | } 47 | //Add some space again! 48 | Spacer() 49 | //Divider also looks great! 50 | Divider() 51 | NavigationLink(destination: ContentView()) { 52 | Label("Settings", systemImage: "gear") 53 | } 54 | } 55 | .listStyle(SidebarListStyle()) 56 | .navigationTitle("Explore") 57 | //Set Sidebar Width (and height) 58 | .frame(minWidth: 150, idealWidth: 250, maxWidth: 300) 59 | .toolbar{ 60 | //Toggle Sidebar Button 61 | ToolbarItem(placement: .navigation){ 62 | Button(action: toggleSidebar, label: { 63 | Image(systemName: "sidebar.left") 64 | }) 65 | } 66 | } 67 | //Default View on Mac 68 | ContentView() 69 | } 70 | } 71 | } 72 | 73 | // Toggle Sidebar Function 74 | func toggleSidebar() { 75 | NSApp.keyWindow?.firstResponder?.tryToPerform(#selector(NSSplitViewController.toggleSidebar(_:)), with: nil) 76 | } 77 | 78 | struct SidebarView_Previews: PreviewProvider { 79 | static var previews: some View { 80 | SidebarView() 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1998code/SwiftUI2-MacSidebar/b18296b8977f75275ce512d516a93416a4df2f34/dark.png -------------------------------------------------------------------------------- /iOS/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 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | 28 | UIApplicationSupportsIndirectInputEvents 29 | 30 | UILaunchScreen 31 | 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1998code/SwiftUI2-MacSidebar/b18296b8977f75275ce512d516a93416a4df2f34/light.png -------------------------------------------------------------------------------- /macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | 26 | 27 | -------------------------------------------------------------------------------- /macOS/macOS.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 | --------------------------------------------------------------------------------