├── README.md ├── VisionExpandingSidebar.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── VisionExpandingSidebar ├── Assets.xcassets ├── AppIcon.appiconset │ ├── Contents.json │ ├── icon-1024.png │ ├── icon-120.png │ ├── icon-152.png │ ├── icon-167.png │ ├── icon-180.png │ ├── icon-29.png │ ├── icon-40.png │ ├── icon-58.png │ ├── icon-60.png │ ├── icon-76.png │ ├── icon-80.png │ ├── icon-87.png │ └── icon20.png └── Contents.json ├── Base.lproj └── LaunchScreen.storyboard ├── Info.plist └── Source ├── Application ├── VESAppDelegate.swift ├── VESSceneDelegate+NSToolbar.swift └── VESSceneDelegate.swift └── Main ├── VESMainViewController.swift └── VESSidebarCollectionViewController.swift /README.md: -------------------------------------------------------------------------------- 1 | # VisionExpandingSidebar 2 | 3 | Quick demonstration of how to make a Safari-style window that expands in size when its sidebar is shown, using UIKit, on visionOS. 4 | 5 | ### Screenshots 6 | 7 | https://github.com/steventroughtonsmith/VisionExpandingSidebar/assets/45212/3bd8c7ff-976d-4455-aea6-442876753915 8 | 9 | -------------------------------------------------------------------------------- /VisionExpandingSidebar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B04FC3E62A88263100CFB197 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B04FC3E52A88263100CFB197 /* Assets.xcassets */; }; 11 | B04FC3EA2A88263100CFB197 /* VESAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B04FC3E92A88263100CFB197 /* VESAppDelegate.swift */; }; 12 | B04FC3EC2A88263100CFB197 /* VESSceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B04FC3EB2A88263100CFB197 /* VESSceneDelegate.swift */; }; 13 | B04FC3EE2A88263100CFB197 /* VESSceneDelegate+NSToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B04FC3ED2A88263100CFB197 /* VESSceneDelegate+NSToolbar.swift */; }; 14 | B04FC3F12A88263100CFB197 /* VESMainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B04FC3F02A88263100CFB197 /* VESMainViewController.swift */; }; 15 | B04FC3F42A88263100CFB197 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B04FC3F22A88263100CFB197 /* LaunchScreen.storyboard */; }; 16 | B04FC3FC2A8826C200CFB197 /* VESSidebarCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B04FC3FB2A8826C200CFB197 /* VESSidebarCollectionViewController.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | B04FC3E22A88263100CFB197 /* VisionExpandingSidebar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VisionExpandingSidebar.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | B04FC3E52A88263100CFB197 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 22 | B04FC3E92A88263100CFB197 /* VESAppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VESAppDelegate.swift; sourceTree = ""; }; 23 | B04FC3EB2A88263100CFB197 /* VESSceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VESSceneDelegate.swift; sourceTree = ""; }; 24 | B04FC3ED2A88263100CFB197 /* VESSceneDelegate+NSToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VESSceneDelegate+NSToolbar.swift"; sourceTree = ""; }; 25 | B04FC3F02A88263100CFB197 /* VESMainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VESMainViewController.swift; sourceTree = ""; }; 26 | B04FC3F32A88263100CFB197 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | B04FC3F52A88263100CFB197 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | B04FC3FB2A8826C200CFB197 /* VESSidebarCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VESSidebarCollectionViewController.swift; sourceTree = ""; }; 29 | B04FC3FD2A882C2400CFB197 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | B04FC3DF2A88263100CFB197 /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | B04FC3D92A88263100CFB197 = { 44 | isa = PBXGroup; 45 | children = ( 46 | B04FC3FD2A882C2400CFB197 /* README.md */, 47 | B04FC3E42A88263100CFB197 /* VisionExpandingSidebar */, 48 | B04FC3E32A88263100CFB197 /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | B04FC3E32A88263100CFB197 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | B04FC3E22A88263100CFB197 /* VisionExpandingSidebar.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | B04FC3E42A88263100CFB197 /* VisionExpandingSidebar */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | B04FC3E52A88263100CFB197 /* Assets.xcassets */, 64 | B04FC3F22A88263100CFB197 /* LaunchScreen.storyboard */, 65 | B04FC3F52A88263100CFB197 /* Info.plist */, 66 | B04FC3E72A88263100CFB197 /* Source */, 67 | ); 68 | path = VisionExpandingSidebar; 69 | sourceTree = ""; 70 | }; 71 | B04FC3E72A88263100CFB197 /* Source */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | B04FC3E82A88263100CFB197 /* Application */, 75 | B04FC3EF2A88263100CFB197 /* Main */, 76 | ); 77 | path = Source; 78 | sourceTree = ""; 79 | }; 80 | B04FC3E82A88263100CFB197 /* Application */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | B04FC3E92A88263100CFB197 /* VESAppDelegate.swift */, 84 | B04FC3EB2A88263100CFB197 /* VESSceneDelegate.swift */, 85 | B04FC3ED2A88263100CFB197 /* VESSceneDelegate+NSToolbar.swift */, 86 | ); 87 | path = Application; 88 | sourceTree = ""; 89 | }; 90 | B04FC3EF2A88263100CFB197 /* Main */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | B04FC3F02A88263100CFB197 /* VESMainViewController.swift */, 94 | B04FC3FB2A8826C200CFB197 /* VESSidebarCollectionViewController.swift */, 95 | ); 96 | path = Main; 97 | sourceTree = ""; 98 | }; 99 | /* End PBXGroup section */ 100 | 101 | /* Begin PBXNativeTarget section */ 102 | B04FC3E12A88263100CFB197 /* VisionExpandingSidebar */ = { 103 | isa = PBXNativeTarget; 104 | buildConfigurationList = B04FC3F82A88263100CFB197 /* Build configuration list for PBXNativeTarget "VisionExpandingSidebar" */; 105 | buildPhases = ( 106 | B04FC3DE2A88263100CFB197 /* Sources */, 107 | B04FC3DF2A88263100CFB197 /* Frameworks */, 108 | B04FC3E02A88263100CFB197 /* Resources */, 109 | ); 110 | buildRules = ( 111 | ); 112 | dependencies = ( 113 | ); 114 | name = VisionExpandingSidebar; 115 | productName = VisionExpandingSidebar; 116 | productReference = B04FC3E22A88263100CFB197 /* VisionExpandingSidebar.app */; 117 | productType = "com.apple.product-type.application"; 118 | }; 119 | /* End PBXNativeTarget section */ 120 | 121 | /* Begin PBXProject section */ 122 | B04FC3DA2A88263100CFB197 /* Project object */ = { 123 | isa = PBXProject; 124 | attributes = { 125 | BuildIndependentTargetsInParallel = 1; 126 | CLASSPREFIX = VES; 127 | LastSwiftUpdateCheck = 1500; 128 | LastUpgradeCheck = 1500; 129 | TargetAttributes = { 130 | B04FC3E12A88263100CFB197 = { 131 | CreatedOnToolsVersion = 15.0; 132 | }; 133 | }; 134 | }; 135 | buildConfigurationList = B04FC3DD2A88263100CFB197 /* Build configuration list for PBXProject "VisionExpandingSidebar" */; 136 | compatibilityVersion = "Xcode 14.0"; 137 | developmentRegion = en; 138 | hasScannedForEncodings = 0; 139 | knownRegions = ( 140 | en, 141 | Base, 142 | ); 143 | mainGroup = B04FC3D92A88263100CFB197; 144 | productRefGroup = B04FC3E32A88263100CFB197 /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | B04FC3E12A88263100CFB197 /* VisionExpandingSidebar */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXResourcesBuildPhase section */ 154 | B04FC3E02A88263100CFB197 /* Resources */ = { 155 | isa = PBXResourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | B04FC3E62A88263100CFB197 /* Assets.xcassets in Resources */, 159 | B04FC3F42A88263100CFB197 /* LaunchScreen.storyboard in Resources */, 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | }; 163 | /* End PBXResourcesBuildPhase section */ 164 | 165 | /* Begin PBXSourcesBuildPhase section */ 166 | B04FC3DE2A88263100CFB197 /* Sources */ = { 167 | isa = PBXSourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | B04FC3FC2A8826C200CFB197 /* VESSidebarCollectionViewController.swift in Sources */, 171 | B04FC3F12A88263100CFB197 /* VESMainViewController.swift in Sources */, 172 | B04FC3EE2A88263100CFB197 /* VESSceneDelegate+NSToolbar.swift in Sources */, 173 | B04FC3EC2A88263100CFB197 /* VESSceneDelegate.swift in Sources */, 174 | B04FC3EA2A88263100CFB197 /* VESAppDelegate.swift in Sources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | /* End PBXSourcesBuildPhase section */ 179 | 180 | /* Begin PBXVariantGroup section */ 181 | B04FC3F22A88263100CFB197 /* LaunchScreen.storyboard */ = { 182 | isa = PBXVariantGroup; 183 | children = ( 184 | B04FC3F32A88263100CFB197 /* Base */, 185 | ); 186 | name = LaunchScreen.storyboard; 187 | sourceTree = ""; 188 | }; 189 | /* End PBXVariantGroup section */ 190 | 191 | /* Begin XCBuildConfiguration section */ 192 | B04FC3F62A88263100CFB197 /* Debug */ = { 193 | isa = XCBuildConfiguration; 194 | buildSettings = { 195 | ALWAYS_SEARCH_USER_PATHS = NO; 196 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 197 | CLANG_ANALYZER_NONNULL = YES; 198 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 199 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 200 | CLANG_ENABLE_MODULES = YES; 201 | CLANG_ENABLE_OBJC_ARC = YES; 202 | CLANG_ENABLE_OBJC_WEAK = YES; 203 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 204 | CLANG_WARN_BOOL_CONVERSION = YES; 205 | CLANG_WARN_COMMA = YES; 206 | CLANG_WARN_CONSTANT_CONVERSION = YES; 207 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 208 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 209 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 210 | CLANG_WARN_EMPTY_BODY = YES; 211 | CLANG_WARN_ENUM_CONVERSION = YES; 212 | CLANG_WARN_INFINITE_RECURSION = YES; 213 | CLANG_WARN_INT_CONVERSION = YES; 214 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 215 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 216 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 217 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 218 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 219 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 220 | CLANG_WARN_STRICT_PROTOTYPES = YES; 221 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 222 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 223 | CLANG_WARN_UNREACHABLE_CODE = YES; 224 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 225 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 226 | COPY_PHASE_STRIP = NO; 227 | DEBUG_INFORMATION_FORMAT = dwarf; 228 | ENABLE_STRICT_OBJC_MSGSEND = YES; 229 | ENABLE_TESTABILITY = YES; 230 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 231 | GCC_C_LANGUAGE_STANDARD = gnu17; 232 | GCC_DYNAMIC_NO_PIC = NO; 233 | GCC_NO_COMMON_BLOCKS = YES; 234 | GCC_OPTIMIZATION_LEVEL = 0; 235 | GCC_PREPROCESSOR_DEFINITIONS = ( 236 | "DEBUG=1", 237 | "$(inherited)", 238 | ); 239 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 240 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 241 | GCC_WARN_UNDECLARED_SELECTOR = YES; 242 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 243 | GCC_WARN_UNUSED_FUNCTION = YES; 244 | GCC_WARN_UNUSED_VARIABLE = YES; 245 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 246 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 247 | MTL_FAST_MATH = YES; 248 | ONLY_ACTIVE_ARCH = YES; 249 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; 250 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 251 | SWIFT_VERSION = 5.0; 252 | }; 253 | name = Debug; 254 | }; 255 | B04FC3F72A88263100CFB197 /* Release */ = { 256 | isa = XCBuildConfiguration; 257 | buildSettings = { 258 | ALWAYS_SEARCH_USER_PATHS = NO; 259 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 260 | CLANG_ANALYZER_NONNULL = YES; 261 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 263 | CLANG_ENABLE_MODULES = YES; 264 | CLANG_ENABLE_OBJC_ARC = YES; 265 | CLANG_ENABLE_OBJC_WEAK = YES; 266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 267 | CLANG_WARN_BOOL_CONVERSION = YES; 268 | CLANG_WARN_COMMA = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 273 | CLANG_WARN_EMPTY_BODY = YES; 274 | CLANG_WARN_ENUM_CONVERSION = YES; 275 | CLANG_WARN_INFINITE_RECURSION = YES; 276 | CLANG_WARN_INT_CONVERSION = YES; 277 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 278 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 279 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 280 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 281 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 283 | CLANG_WARN_STRICT_PROTOTYPES = YES; 284 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 285 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 286 | CLANG_WARN_UNREACHABLE_CODE = YES; 287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 288 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 289 | COPY_PHASE_STRIP = NO; 290 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 291 | ENABLE_NS_ASSERTIONS = NO; 292 | ENABLE_STRICT_OBJC_MSGSEND = YES; 293 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 294 | GCC_C_LANGUAGE_STANDARD = gnu17; 295 | GCC_NO_COMMON_BLOCKS = YES; 296 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 297 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 298 | GCC_WARN_UNDECLARED_SELECTOR = YES; 299 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 300 | GCC_WARN_UNUSED_FUNCTION = YES; 301 | GCC_WARN_UNUSED_VARIABLE = YES; 302 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 303 | MTL_ENABLE_DEBUG_INFO = NO; 304 | MTL_FAST_MATH = YES; 305 | SWIFT_COMPILATION_MODE = wholemodule; 306 | SWIFT_VERSION = 5.0; 307 | }; 308 | name = Release; 309 | }; 310 | B04FC3F92A88263100CFB197 /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 314 | CLANG_STATIC_ANALYZER_MODE = deep; 315 | CODE_SIGN_IDENTITY = "iPhone Developer"; 316 | CODE_SIGN_STYLE = Automatic; 317 | CURRENT_PROJECT_VERSION = 1; 318 | DEVELOPMENT_TEAM = 2ZDN69KUUV; 319 | GCC_TREAT_WARNINGS_AS_ERRORS = deep; 320 | GCC_WARN_PEDANTIC = deep; 321 | GENERATE_INFOPLIST_FILE = YES; 322 | INFOPLIST_FILE = "$(PRODUCT_NAME)/Info.plist"; 323 | IPHONEOS_DEPLOYMENT_TARGET = 17.0; 324 | LD_RUNPATH_SEARCH_PATHS = ( 325 | "$(inherited)", 326 | "@executable_path/Frameworks", 327 | ); 328 | MARKETING_VERSION = 1.0; 329 | PRODUCT_BUNDLE_IDENTIFIER = com.highcaffeinecontent.VisionExpandingSidebar; 330 | PRODUCT_NAME = VisionExpandingSidebar; 331 | RUN_CLANG_STATIC_ANALYZER = YES; 332 | SDKROOT = iphoneos; 333 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; 334 | SUPPORTS_MACCATALYST = YES; 335 | SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; 336 | SWIFT_EMIT_LOC_STRINGS = YES; 337 | SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; 338 | SWIFT_VERSION = 5.0; 339 | TARGETED_DEVICE_FAMILY = "1,2,6,7"; 340 | }; 341 | name = Debug; 342 | }; 343 | B04FC3FA2A88263100CFB197 /* Release */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 347 | CLANG_STATIC_ANALYZER_MODE = deep; 348 | CODE_SIGN_IDENTITY = "iPhone Developer"; 349 | CODE_SIGN_STYLE = Automatic; 350 | CURRENT_PROJECT_VERSION = 1; 351 | DEVELOPMENT_TEAM = 2ZDN69KUUV; 352 | GCC_TREAT_WARNINGS_AS_ERRORS = deep; 353 | GCC_WARN_PEDANTIC = deep; 354 | GENERATE_INFOPLIST_FILE = YES; 355 | INFOPLIST_FILE = "$(PRODUCT_NAME)/Info.plist"; 356 | IPHONEOS_DEPLOYMENT_TARGET = 17.0; 357 | LD_RUNPATH_SEARCH_PATHS = ( 358 | "$(inherited)", 359 | "@executable_path/Frameworks", 360 | ); 361 | MARKETING_VERSION = 1.0; 362 | PRODUCT_BUNDLE_IDENTIFIER = com.highcaffeinecontent.VisionExpandingSidebar; 363 | PRODUCT_NAME = VisionExpandingSidebar; 364 | RUN_CLANG_STATIC_ANALYZER = YES; 365 | SDKROOT = iphoneos; 366 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; 367 | SUPPORTS_MACCATALYST = YES; 368 | SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; 369 | SWIFT_EMIT_LOC_STRINGS = YES; 370 | SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; 371 | SWIFT_VERSION = 5.0; 372 | TARGETED_DEVICE_FAMILY = "1,2,6,7"; 373 | VALIDATE_PRODUCT = YES; 374 | }; 375 | name = Release; 376 | }; 377 | /* End XCBuildConfiguration section */ 378 | 379 | /* Begin XCConfigurationList section */ 380 | B04FC3DD2A88263100CFB197 /* Build configuration list for PBXProject "VisionExpandingSidebar" */ = { 381 | isa = XCConfigurationList; 382 | buildConfigurations = ( 383 | B04FC3F62A88263100CFB197 /* Debug */, 384 | B04FC3F72A88263100CFB197 /* Release */, 385 | ); 386 | defaultConfigurationIsVisible = 0; 387 | defaultConfigurationName = Release; 388 | }; 389 | B04FC3F82A88263100CFB197 /* Build configuration list for PBXNativeTarget "VisionExpandingSidebar" */ = { 390 | isa = XCConfigurationList; 391 | buildConfigurations = ( 392 | B04FC3F92A88263100CFB197 /* Debug */, 393 | B04FC3FA2A88263100CFB197 /* Release */, 394 | ); 395 | defaultConfigurationIsVisible = 0; 396 | defaultConfigurationName = Release; 397 | }; 398 | /* End XCConfigurationList section */ 399 | }; 400 | rootObject = B04FC3DA2A88263100CFB197 /* Project object */; 401 | } 402 | -------------------------------------------------------------------------------- /VisionExpandingSidebar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "size": "20x20", 5 | "idiom": "iphone", 6 | "filename": "icon-40.png", 7 | "scale": "2x" 8 | }, 9 | { 10 | "size": "20x20", 11 | "idiom": "iphone", 12 | "filename": "icon-60.png", 13 | "scale": "3x" 14 | }, 15 | { 16 | "size": "29x29", 17 | "idiom": "iphone", 18 | "filename": "icon-58.png", 19 | "scale": "2x" 20 | }, 21 | { 22 | "size": "29x29", 23 | "idiom": "iphone", 24 | "filename": "icon-87.png", 25 | "scale": "3x" 26 | }, 27 | { 28 | "size": "40x40", 29 | "idiom": "iphone", 30 | "filename": "icon-80.png", 31 | "scale": "2x" 32 | }, 33 | { 34 | "size": "40x40", 35 | "idiom": "iphone", 36 | "filename": "icon-120.png", 37 | "scale": "3x" 38 | }, 39 | { 40 | "size": "60x60", 41 | "idiom": "iphone", 42 | "filename": "icon-120.png", 43 | "scale": "2x" 44 | }, 45 | { 46 | "size": "60x60", 47 | "idiom": "iphone", 48 | "filename": "icon-180.png", 49 | "scale": "3x" 50 | }, 51 | { 52 | "size": "20x20", 53 | "idiom": "ipad", 54 | "filename": "icon20.png", 55 | "scale": "1x" 56 | }, 57 | { 58 | "size": "20x20", 59 | "idiom": "ipad", 60 | "filename": "icon-40.png", 61 | "scale": "2x" 62 | }, 63 | { 64 | "size": "29x29", 65 | "idiom": "ipad", 66 | "filename": "icon-29.png", 67 | "scale": "1x" 68 | }, 69 | { 70 | "size": "29x29", 71 | "idiom": "ipad", 72 | "filename": "icon-58.png", 73 | "scale": "2x" 74 | }, 75 | { 76 | "size": "40x40", 77 | "idiom": "ipad", 78 | "filename": "icon-40.png", 79 | "scale": "1x" 80 | }, 81 | { 82 | "size": "40x40", 83 | "idiom": "ipad", 84 | "filename": "icon-80.png", 85 | "scale": "2x" 86 | }, 87 | { 88 | "size": "76x76", 89 | "idiom": "ipad", 90 | "filename": "icon-76.png", 91 | "scale": "1x" 92 | }, 93 | { 94 | "size": "76x76", 95 | "idiom": "ipad", 96 | "filename": "icon-152.png", 97 | "scale": "2x" 98 | }, 99 | { 100 | "size": "83.5x83.5", 101 | "idiom": "ipad", 102 | "filename": "icon-167.png", 103 | "scale": "2x" 104 | }, 105 | { 106 | "size": "1024x1024", 107 | "idiom": "ios-marketing", 108 | "filename": "icon-1024.png", 109 | "scale": "1x" 110 | } 111 | ], 112 | "info": { 113 | "version": 1, 114 | "author": "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-120.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-152.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-167.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-180.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-58.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-60.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-80.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon-87.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/VisionExpandingSidebar/c7d5124a46e264ee7dcff9e371c5327f95c254d4/VisionExpandingSidebar/Assets.xcassets/AppIcon.appiconset/icon20.png -------------------------------------------------------------------------------- /VisionExpandingSidebar/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /VisionExpandingSidebar/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /VisionExpandingSidebar/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ITSAppUsesNonExemptEncryption 6 | 7 | LSRequiresIPhoneOS 8 | 9 | UIApplicationSceneManifest 10 | 11 | UIApplicationSupportsMultipleScenes 12 | 13 | UISceneConfigurations 14 | 15 | UIWindowSceneSessionRoleApplication 16 | 17 | 18 | UISceneConfigurationName 19 | Default Configuration 20 | UISceneDelegateClassName 21 | $(PRODUCT_MODULE_NAME).VESSceneDelegate 22 | 23 | 24 | 25 | 26 | UIApplicationSupportsIndirectInputEvents 27 | 28 | UILaunchStoryboardName 29 | LaunchScreen 30 | UIRequiredDeviceCapabilities 31 | 32 | armv7 33 | 34 | UISupportedInterfaceOrientations 35 | 36 | UIInterfaceOrientationPortrait 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | UISupportedInterfaceOrientations~ipad 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationPortraitUpsideDown 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /VisionExpandingSidebar/Source/Application/VESAppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VESAppDelegate.swift 3 | // VisionExpandingSidebar 4 | // 5 | // Created by Steven Troughton-Smith on 12/08/2023. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class VESAppDelegate: UIResponder, UIApplicationDelegate { 13 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 14 | return true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /VisionExpandingSidebar/Source/Application/VESSceneDelegate+NSToolbar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VESSceneDelegate+NSToolbar.swift 3 | // VisionExpandingSidebar 4 | // 5 | // Created by Steven Troughton-Smith on 12/08/2023. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | #if targetEnvironment(macCatalyst) 12 | import AppKit 13 | 14 | extension VESSceneDelegate: NSToolbarDelegate { 15 | 16 | func toolbarItems() -> [NSToolbarItem.Identifier] { 17 | return [.toggleSidebar] 18 | } 19 | 20 | func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { 21 | return toolbarItems() 22 | } 23 | 24 | func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { 25 | return toolbarItems() 26 | } 27 | 28 | func toolbar(_ toolbar: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar flag: Bool) -> NSToolbarItem? { 29 | return NSToolbarItem(itemIdentifier: itemIdentifier) 30 | } 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /VisionExpandingSidebar/Source/Application/VESSceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VESSceneDelegate.swift 3 | // VisionExpandingSidebar 4 | // 5 | // Created by Steven Troughton-Smith on 12/08/2023. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | class VESSceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | var window: UIWindow? 13 | 14 | let rootSplitViewController = UISplitViewController() 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | guard let windowScene = scene as? UIWindowScene else { 18 | fatalError("Expected scene of type UIWindowScene but got an unexpected type") 19 | } 20 | window = UIWindow(windowScene: windowScene) 21 | 22 | if let window = window { 23 | rootSplitViewController.primaryBackgroundStyle = .sidebar 24 | rootSplitViewController.viewControllers = [VESSidebarCollectionViewController(), VESMainViewController()] 25 | 26 | rootSplitViewController.preferredDisplayMode = .secondaryOnly 27 | 28 | window.rootViewController = rootSplitViewController 29 | 30 | #if targetEnvironment(macCatalyst) 31 | 32 | let toolbar = NSToolbar(identifier: NSToolbar.Identifier("VESSceneDelegate.Toolbar")) 33 | toolbar.delegate = self 34 | toolbar.displayMode = .iconOnly 35 | toolbar.allowsUserCustomization = false 36 | 37 | windowScene.titlebar?.toolbar = toolbar 38 | windowScene.titlebar?.toolbarStyle = .unified 39 | 40 | #endif 41 | NotificationCenter.default.addObserver(forName: NSNotification.Name("ToggleSidebar"), object: nil, queue: .main) { [weak self] _ in 42 | self?.toggleSidebarVisibility() 43 | } 44 | 45 | window.makeKeyAndVisible() 46 | } 47 | } 48 | 49 | func toggleSidebarVisibility() { 50 | 51 | let delta = CGFloat(320) 52 | 53 | let currentSize = window?.bounds.size ?? .zero 54 | 55 | UIView.animate(withDuration: 0.3) { [weak self] in 56 | if self?.rootSplitViewController.displayMode == .secondaryOnly { 57 | self?.rootSplitViewController.preferredDisplayMode = .oneBesideSecondary 58 | self?.resizeWindow(to: CGSize(width: currentSize.width+delta, height: currentSize.height)) 59 | } 60 | else { 61 | self?.rootSplitViewController.preferredDisplayMode = .secondaryOnly 62 | self?.resizeWindow(to: CGSize(width: currentSize.width-delta, height: currentSize.height)) 63 | } 64 | } 65 | } 66 | 67 | func resizeWindow(to size:CGSize) { 68 | guard let windowScene = window?.windowScene as? UIWindowScene else { return } 69 | 70 | #if os(xrOS) 71 | 72 | let geo = UIWindowScene.GeometryPreferences.Reality() 73 | 74 | geo.size = size 75 | 76 | windowScene.requestGeometryUpdate(geo) 77 | #endif 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /VisionExpandingSidebar/Source/Main/VESMainViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VESMainViewController.swift 3 | // VisionExpandingSidebar 4 | // 5 | // Created by Steven Troughton-Smith on 12/08/2023. 6 | // 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | struct VESOrnament: View { 13 | var body: some View { 14 | HStack { 15 | Button { 16 | NotificationCenter.default.post(name: NSNotification.Name("ToggleSidebar"), object: nil) 17 | } label: { 18 | Image(systemName:"sidebar.leading") 19 | } 20 | .padding() 21 | } 22 | .glassBackgroundEffect() 23 | } 24 | } 25 | 26 | final class VESMainViewController: UIViewController { 27 | 28 | init() { 29 | super.init(nibName: nil, bundle: nil) 30 | setupOrnament() 31 | } 32 | 33 | required init?(coder aDecoder: NSCoder) { 34 | fatalError("init(coder:) has not been implemented") 35 | } 36 | 37 | // MARK: - 38 | 39 | func setupOrnament() { 40 | #if os(xrOS) 41 | let ornament = UIHostingOrnament(sceneAlignment: .top, contentAlignment: .center) { 42 | VESOrnament() 43 | } 44 | 45 | ornaments = [ornament] 46 | #endif 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /VisionExpandingSidebar/Source/Main/VESSidebarCollectionViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VESSidebarCollectionViewController.swift 3 | // VisionExpandingSidebar 4 | // 5 | // Created by Steven Troughton-Smith on 12/08/2023. 6 | // 7 | 8 | import UIKit 9 | 10 | class VESSidebarCollectionViewController: UICollectionViewController { 11 | enum Section { 12 | case main 13 | } 14 | 15 | struct Item: Hashable { 16 | var identifier = UUID().uuidString 17 | 18 | func hash(into hasher: inout Hasher) { 19 | hasher.combine(identifier) 20 | } 21 | 22 | static func == (lhs: Item, rhs: Item) -> Bool { 23 | return lhs.identifier == rhs.identifier 24 | } 25 | } 26 | 27 | typealias ItemType = Item 28 | 29 | let reuseIdentifier = "Cell" 30 | var dataSource: UICollectionViewDiffableDataSource! = nil 31 | var currentItems:[ItemType] = [] 32 | 33 | init() { 34 | let configuration = UICollectionLayoutListConfiguration(appearance: .sidebar) 35 | let layout = UICollectionViewCompositionalLayout.list(using: configuration) 36 | 37 | super.init(collectionViewLayout: layout) 38 | guard let collectionView = collectionView else { return } 39 | 40 | collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier) 41 | 42 | configureDataSource() 43 | } 44 | 45 | required init?(coder: NSCoder) { 46 | fatalError("init(coder:) has not been implemented") 47 | } 48 | 49 | // MARK: - Data Source 50 | 51 | func configureDataSource() { 52 | 53 | dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { 54 | (collectionView: UICollectionView, indexPath: IndexPath, item: ItemType) -> UICollectionViewCell? in 55 | 56 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: self.reuseIdentifier, for: indexPath) 57 | 58 | var config = UIListContentConfiguration.sidebarCell() 59 | 60 | config.text = "Cell" 61 | config.image = UIImage(systemName: "star") 62 | 63 | cell.contentConfiguration = config 64 | 65 | return cell 66 | } 67 | 68 | collectionView.dataSource = dataSource 69 | 70 | refresh() 71 | } 72 | 73 | func snapshot() -> NSDiffableDataSourceSectionSnapshot { 74 | var snapshot = NSDiffableDataSourceSectionSnapshot() 75 | 76 | currentItems = [ItemType(), ItemType(), ItemType()] 77 | snapshot.append(currentItems) 78 | 79 | return snapshot 80 | } 81 | 82 | func refresh() { 83 | guard let dataSource = collectionView.dataSource as? UICollectionViewDiffableDataSource else { return } 84 | 85 | dataSource.apply(snapshot(), to: .main, animatingDifferences: false) 86 | } 87 | } 88 | --------------------------------------------------------------------------------