├── Catalyst Grid App.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── Catalyst Grid App.xcscheme ├── Catalyst Grid App ├── 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 ├── Localizable.strings └── Source │ ├── Application │ ├── CGAAppDelegate+MenuBuilder.swift │ ├── CGAAppDelegate.swift │ ├── CGASceneDelegate+NSToolbar.swift │ └── CGASceneDelegate.swift │ ├── Custom Views │ ├── SBAHairlineDividerView.swift │ └── SBAVisualEffectView.swift │ ├── Main │ ├── CGAInspectorViewController.swift │ ├── CGAMainViewController.swift │ ├── CGASidebarSourceListViewController.swift │ └── Grid View │ │ ├── CGAGridViewCell.swift │ │ └── CGAGridViewController.swift │ └── Number+Scaling.swift └── README.md /Catalyst Grid App.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B07B4C31270F68B700A7F560 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B07B4C30270F68B700A7F560 /* Assets.xcassets */; }; 11 | B07B4C35270F68B700A7F560 /* CGAAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C34270F68B700A7F560 /* CGAAppDelegate.swift */; }; 12 | B07B4C37270F68B700A7F560 /* CGASceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C36270F68B700A7F560 /* CGASceneDelegate.swift */; }; 13 | B07B4C39270F68B700A7F560 /* CGASceneDelegate+NSToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C38270F68B700A7F560 /* CGASceneDelegate+NSToolbar.swift */; }; 14 | B07B4C3C270F68B700A7F560 /* CGAMainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C3B270F68B700A7F560 /* CGAMainViewController.swift */; }; 15 | B07B4C3F270F68B700A7F560 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B07B4C3D270F68B700A7F560 /* LaunchScreen.storyboard */; }; 16 | B07B4C47270F68F900A7F560 /* Number+Scaling.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C46270F68F900A7F560 /* Number+Scaling.swift */; }; 17 | B07B4C49270F698A00A7F560 /* CGASidebarSourceListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C48270F698A00A7F560 /* CGASidebarSourceListViewController.swift */; }; 18 | B07B4C4B270F6A6500A7F560 /* CGAGridViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C4A270F6A6500A7F560 /* CGAGridViewController.swift */; }; 19 | B07B4C4D270F6A7300A7F560 /* CGAInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C4C270F6A7300A7F560 /* CGAInspectorViewController.swift */; }; 20 | B07B4C4F270F6A9D00A7F560 /* SBAHairlineDividerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C4E270F6A9D00A7F560 /* SBAHairlineDividerView.swift */; }; 21 | B07B4C51270F6AA500A7F560 /* SBAVisualEffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C50270F6AA500A7F560 /* SBAVisualEffectView.swift */; }; 22 | B07B4C54270F6B7400A7F560 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B07B4C53270F6B7400A7F560 /* Localizable.strings */; }; 23 | B07B4C56270F6E7700A7F560 /* CGAGridViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B07B4C55270F6E7700A7F560 /* CGAGridViewCell.swift */; }; 24 | B0DC7E7C270F757800E14BBD /* CGAAppDelegate+MenuBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0DC7E7B270F757800E14BBD /* CGAAppDelegate+MenuBuilder.swift */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | B07B4C2D270F68B700A7F560 /* Catalyst Grid App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Catalyst Grid App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | B07B4C30270F68B700A7F560 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | B07B4C34270F68B700A7F560 /* CGAAppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGAAppDelegate.swift; sourceTree = ""; }; 31 | B07B4C36270F68B700A7F560 /* CGASceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGASceneDelegate.swift; sourceTree = ""; }; 32 | B07B4C38270F68B700A7F560 /* CGASceneDelegate+NSToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGASceneDelegate+NSToolbar.swift"; sourceTree = ""; }; 33 | B07B4C3B270F68B700A7F560 /* CGAMainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGAMainViewController.swift; sourceTree = ""; }; 34 | B07B4C3E270F68B700A7F560 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 35 | B07B4C40270F68B700A7F560 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | B07B4C46270F68F900A7F560 /* Number+Scaling.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Number+Scaling.swift"; sourceTree = ""; }; 37 | B07B4C48270F698A00A7F560 /* CGASidebarSourceListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGASidebarSourceListViewController.swift; sourceTree = ""; }; 38 | B07B4C4A270F6A6500A7F560 /* CGAGridViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGAGridViewController.swift; sourceTree = ""; }; 39 | B07B4C4C270F6A7300A7F560 /* CGAInspectorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGAInspectorViewController.swift; sourceTree = ""; }; 40 | B07B4C4E270F6A9D00A7F560 /* SBAHairlineDividerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SBAHairlineDividerView.swift; sourceTree = ""; }; 41 | B07B4C50270F6AA500A7F560 /* SBAVisualEffectView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SBAVisualEffectView.swift; sourceTree = ""; }; 42 | B07B4C53270F6B7400A7F560 /* Localizable.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; 43 | B07B4C55270F6E7700A7F560 /* CGAGridViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGAGridViewCell.swift; sourceTree = ""; }; 44 | B0DC7E7B270F757800E14BBD /* CGAAppDelegate+MenuBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CGAAppDelegate+MenuBuilder.swift"; sourceTree = ""; }; 45 | B0DC7E7E270F76B800E14BBD /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | B07B4C2A270F68B700A7F560 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | B07B4C24270F68B700A7F560 = { 60 | isa = PBXGroup; 61 | children = ( 62 | B0DC7E7E270F76B800E14BBD /* README.md */, 63 | B07B4C2F270F68B700A7F560 /* Catalyst Grid App */, 64 | B07B4C2E270F68B700A7F560 /* Products */, 65 | ); 66 | sourceTree = ""; 67 | }; 68 | B07B4C2E270F68B700A7F560 /* Products */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | B07B4C2D270F68B700A7F560 /* Catalyst Grid App.app */, 72 | ); 73 | name = Products; 74 | sourceTree = ""; 75 | }; 76 | B07B4C2F270F68B700A7F560 /* Catalyst Grid App */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | B07B4C30270F68B700A7F560 /* Assets.xcassets */, 80 | B07B4C3D270F68B700A7F560 /* LaunchScreen.storyboard */, 81 | B07B4C40270F68B700A7F560 /* Info.plist */, 82 | B07B4C53270F6B7400A7F560 /* Localizable.strings */, 83 | B07B4C32270F68B700A7F560 /* Source */, 84 | ); 85 | path = "Catalyst Grid App"; 86 | sourceTree = ""; 87 | }; 88 | B07B4C32270F68B700A7F560 /* Source */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | B07B4C46270F68F900A7F560 /* Number+Scaling.swift */, 92 | B07B4C33270F68B700A7F560 /* Application */, 93 | B07B4C52270F6AA900A7F560 /* Custom Views */, 94 | B07B4C3A270F68B700A7F560 /* Main */, 95 | ); 96 | path = Source; 97 | sourceTree = ""; 98 | }; 99 | B07B4C33270F68B700A7F560 /* Application */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | B07B4C34270F68B700A7F560 /* CGAAppDelegate.swift */, 103 | B0DC7E7B270F757800E14BBD /* CGAAppDelegate+MenuBuilder.swift */, 104 | B07B4C36270F68B700A7F560 /* CGASceneDelegate.swift */, 105 | B07B4C38270F68B700A7F560 /* CGASceneDelegate+NSToolbar.swift */, 106 | ); 107 | path = Application; 108 | sourceTree = ""; 109 | }; 110 | B07B4C3A270F68B700A7F560 /* Main */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | B07B4C48270F698A00A7F560 /* CGASidebarSourceListViewController.swift */, 114 | B07B4C3B270F68B700A7F560 /* CGAMainViewController.swift */, 115 | B0DC7E7A270F727000E14BBD /* Grid View */, 116 | B07B4C4C270F6A7300A7F560 /* CGAInspectorViewController.swift */, 117 | ); 118 | path = Main; 119 | sourceTree = ""; 120 | }; 121 | B07B4C52270F6AA900A7F560 /* Custom Views */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | B07B4C4E270F6A9D00A7F560 /* SBAHairlineDividerView.swift */, 125 | B07B4C50270F6AA500A7F560 /* SBAVisualEffectView.swift */, 126 | ); 127 | path = "Custom Views"; 128 | sourceTree = ""; 129 | }; 130 | B0DC7E7A270F727000E14BBD /* Grid View */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | B07B4C4A270F6A6500A7F560 /* CGAGridViewController.swift */, 134 | B07B4C55270F6E7700A7F560 /* CGAGridViewCell.swift */, 135 | ); 136 | path = "Grid View"; 137 | sourceTree = ""; 138 | }; 139 | /* End PBXGroup section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | B07B4C2C270F68B700A7F560 /* Catalyst Grid App */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = B07B4C43270F68B700A7F560 /* Build configuration list for PBXNativeTarget "Catalyst Grid App" */; 145 | buildPhases = ( 146 | B07B4C29270F68B700A7F560 /* Sources */, 147 | B07B4C2A270F68B700A7F560 /* Frameworks */, 148 | B07B4C2B270F68B700A7F560 /* Resources */, 149 | ); 150 | buildRules = ( 151 | ); 152 | dependencies = ( 153 | ); 154 | name = "Catalyst Grid App"; 155 | productName = "Catalyst Grid App"; 156 | productReference = B07B4C2D270F68B700A7F560 /* Catalyst Grid App.app */; 157 | productType = "com.apple.product-type.application"; 158 | }; 159 | /* End PBXNativeTarget section */ 160 | 161 | /* Begin PBXProject section */ 162 | B07B4C25270F68B700A7F560 /* Project object */ = { 163 | isa = PBXProject; 164 | attributes = { 165 | BuildIndependentTargetsInParallel = 1; 166 | CLASSPREFIX = CGA; 167 | LastSwiftUpdateCheck = 1300; 168 | LastUpgradeCheck = 1300; 169 | TargetAttributes = { 170 | B07B4C2C270F68B700A7F560 = { 171 | CreatedOnToolsVersion = 13.0; 172 | }; 173 | }; 174 | }; 175 | buildConfigurationList = B07B4C28270F68B700A7F560 /* Build configuration list for PBXProject "Catalyst Grid App" */; 176 | compatibilityVersion = "Xcode 13.0"; 177 | developmentRegion = en; 178 | hasScannedForEncodings = 0; 179 | knownRegions = ( 180 | en, 181 | Base, 182 | ); 183 | mainGroup = B07B4C24270F68B700A7F560; 184 | productRefGroup = B07B4C2E270F68B700A7F560 /* Products */; 185 | projectDirPath = ""; 186 | projectRoot = ""; 187 | targets = ( 188 | B07B4C2C270F68B700A7F560 /* Catalyst Grid App */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | B07B4C2B270F68B700A7F560 /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | B07B4C31270F68B700A7F560 /* Assets.xcassets in Resources */, 199 | B07B4C54270F6B7400A7F560 /* Localizable.strings in Resources */, 200 | B07B4C3F270F68B700A7F560 /* LaunchScreen.storyboard in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | /* End PBXResourcesBuildPhase section */ 205 | 206 | /* Begin PBXSourcesBuildPhase section */ 207 | B07B4C29270F68B700A7F560 /* Sources */ = { 208 | isa = PBXSourcesBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | B07B4C35270F68B700A7F560 /* CGAAppDelegate.swift in Sources */, 212 | B07B4C49270F698A00A7F560 /* CGASidebarSourceListViewController.swift in Sources */, 213 | B07B4C3C270F68B700A7F560 /* CGAMainViewController.swift in Sources */, 214 | B07B4C37270F68B700A7F560 /* CGASceneDelegate.swift in Sources */, 215 | B0DC7E7C270F757800E14BBD /* CGAAppDelegate+MenuBuilder.swift in Sources */, 216 | B07B4C4B270F6A6500A7F560 /* CGAGridViewController.swift in Sources */, 217 | B07B4C47270F68F900A7F560 /* Number+Scaling.swift in Sources */, 218 | B07B4C56270F6E7700A7F560 /* CGAGridViewCell.swift in Sources */, 219 | B07B4C51270F6AA500A7F560 /* SBAVisualEffectView.swift in Sources */, 220 | B07B4C4F270F6A9D00A7F560 /* SBAHairlineDividerView.swift in Sources */, 221 | B07B4C4D270F6A7300A7F560 /* CGAInspectorViewController.swift in Sources */, 222 | B07B4C39270F68B700A7F560 /* CGASceneDelegate+NSToolbar.swift in Sources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXSourcesBuildPhase section */ 227 | 228 | /* Begin PBXVariantGroup section */ 229 | B07B4C3D270F68B700A7F560 /* LaunchScreen.storyboard */ = { 230 | isa = PBXVariantGroup; 231 | children = ( 232 | B07B4C3E270F68B700A7F560 /* Base */, 233 | ); 234 | name = LaunchScreen.storyboard; 235 | sourceTree = ""; 236 | }; 237 | /* End PBXVariantGroup section */ 238 | 239 | /* Begin XCBuildConfiguration section */ 240 | B07B4C41270F68B700A7F560 /* Debug */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | CLANG_ANALYZER_NONNULL = YES; 245 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 246 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 247 | CLANG_CXX_LIBRARY = "libc++"; 248 | CLANG_ENABLE_MODULES = YES; 249 | CLANG_ENABLE_OBJC_ARC = YES; 250 | CLANG_ENABLE_OBJC_WEAK = YES; 251 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 252 | CLANG_WARN_BOOL_CONVERSION = YES; 253 | CLANG_WARN_COMMA = YES; 254 | CLANG_WARN_CONSTANT_CONVERSION = YES; 255 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 256 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 257 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 263 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 264 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 266 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 267 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 268 | CLANG_WARN_STRICT_PROTOTYPES = YES; 269 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 270 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 274 | COPY_PHASE_STRIP = NO; 275 | DEBUG_INFORMATION_FORMAT = dwarf; 276 | ENABLE_STRICT_OBJC_MSGSEND = YES; 277 | ENABLE_TESTABILITY = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu11; 279 | GCC_DYNAMIC_NO_PIC = NO; 280 | GCC_NO_COMMON_BLOCKS = YES; 281 | GCC_OPTIMIZATION_LEVEL = 0; 282 | GCC_PREPROCESSOR_DEFINITIONS = ( 283 | "DEBUG=1", 284 | "$(inherited)", 285 | ); 286 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 287 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 288 | GCC_WARN_UNDECLARED_SELECTOR = YES; 289 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 290 | GCC_WARN_UNUSED_FUNCTION = YES; 291 | GCC_WARN_UNUSED_VARIABLE = YES; 292 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 293 | MTL_FAST_MATH = YES; 294 | ONLY_ACTIVE_ARCH = YES; 295 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 296 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 297 | SWIFT_VERSION = 5.0; 298 | }; 299 | name = Debug; 300 | }; 301 | B07B4C42270F68B700A7F560 /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ALWAYS_SEARCH_USER_PATHS = NO; 305 | CLANG_ANALYZER_NONNULL = YES; 306 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_ENABLE_OBJC_WEAK = YES; 312 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_COMMA = YES; 315 | CLANG_WARN_CONSTANT_CONVERSION = YES; 316 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 319 | CLANG_WARN_EMPTY_BODY = YES; 320 | CLANG_WARN_ENUM_CONVERSION = YES; 321 | CLANG_WARN_INFINITE_RECURSION = YES; 322 | CLANG_WARN_INT_CONVERSION = YES; 323 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 325 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 326 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 327 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 328 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 329 | CLANG_WARN_STRICT_PROTOTYPES = YES; 330 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 331 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 332 | CLANG_WARN_UNREACHABLE_CODE = YES; 333 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 334 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 335 | COPY_PHASE_STRIP = NO; 336 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 337 | ENABLE_NS_ASSERTIONS = NO; 338 | ENABLE_STRICT_OBJC_MSGSEND = YES; 339 | GCC_C_LANGUAGE_STANDARD = gnu11; 340 | GCC_NO_COMMON_BLOCKS = YES; 341 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 342 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 343 | GCC_WARN_UNDECLARED_SELECTOR = YES; 344 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 345 | GCC_WARN_UNUSED_FUNCTION = YES; 346 | GCC_WARN_UNUSED_VARIABLE = YES; 347 | MTL_ENABLE_DEBUG_INFO = NO; 348 | MTL_FAST_MATH = YES; 349 | SWIFT_COMPILATION_MODE = wholemodule; 350 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 351 | SWIFT_VERSION = 5.0; 352 | }; 353 | name = Release; 354 | }; 355 | B07B4C44270F68B700A7F560 /* Debug */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 359 | CLANG_STATIC_ANALYZER_MODE = deep; 360 | CODE_SIGN_IDENTITY = "iPhone Developer"; 361 | CODE_SIGN_STYLE = Automatic; 362 | CURRENT_PROJECT_VERSION = 1; 363 | DEVELOPMENT_TEAM = 2ZDN69KUUV; 364 | GCC_TREAT_WARNINGS_AS_ERRORS = deep; 365 | GCC_WARN_PEDANTIC = deep; 366 | GENERATE_INFOPLIST_FILE = YES; 367 | INFOPLIST_FILE = "$(PRODUCT_NAME)/Info.plist"; 368 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 369 | "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2; 370 | LD_RUNPATH_SEARCH_PATHS = ( 371 | "$(inherited)", 372 | "@executable_path/Frameworks", 373 | ); 374 | MARKETING_VERSION = 1.0; 375 | PRODUCT_BUNDLE_IDENTIFIER = "com.highcaffeinecontent.Catalyst-Grid-App"; 376 | PRODUCT_NAME = "Catalyst Grid App"; 377 | RUN_CLANG_STATIC_ANALYZER = YES; 378 | SDKROOT = iphoneos; 379 | SUPPORTS_MACCATALYST = YES; 380 | SWIFT_EMIT_LOC_STRINGS = YES; 381 | SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; 382 | SWIFT_VERSION = 5.0; 383 | TARGETED_DEVICE_FAMILY = "1,2,6"; 384 | }; 385 | name = Debug; 386 | }; 387 | B07B4C45270F68B700A7F560 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 391 | CLANG_STATIC_ANALYZER_MODE = deep; 392 | CODE_SIGN_IDENTITY = "iPhone Developer"; 393 | CODE_SIGN_STYLE = Automatic; 394 | CURRENT_PROJECT_VERSION = 1; 395 | DEVELOPMENT_TEAM = 2ZDN69KUUV; 396 | GCC_TREAT_WARNINGS_AS_ERRORS = deep; 397 | GCC_WARN_PEDANTIC = deep; 398 | GENERATE_INFOPLIST_FILE = YES; 399 | INFOPLIST_FILE = "$(PRODUCT_NAME)/Info.plist"; 400 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 401 | "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2; 402 | LD_RUNPATH_SEARCH_PATHS = ( 403 | "$(inherited)", 404 | "@executable_path/Frameworks", 405 | ); 406 | MARKETING_VERSION = 1.0; 407 | PRODUCT_BUNDLE_IDENTIFIER = "com.highcaffeinecontent.Catalyst-Grid-App"; 408 | PRODUCT_NAME = "Catalyst Grid App"; 409 | RUN_CLANG_STATIC_ANALYZER = YES; 410 | SDKROOT = iphoneos; 411 | SUPPORTS_MACCATALYST = YES; 412 | SWIFT_EMIT_LOC_STRINGS = YES; 413 | SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; 414 | SWIFT_VERSION = 5.0; 415 | TARGETED_DEVICE_FAMILY = "1,2,6"; 416 | VALIDATE_PRODUCT = YES; 417 | }; 418 | name = Release; 419 | }; 420 | /* End XCBuildConfiguration section */ 421 | 422 | /* Begin XCConfigurationList section */ 423 | B07B4C28270F68B700A7F560 /* Build configuration list for PBXProject "Catalyst Grid App" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | B07B4C41270F68B700A7F560 /* Debug */, 427 | B07B4C42270F68B700A7F560 /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | defaultConfigurationName = Release; 431 | }; 432 | B07B4C43270F68B700A7F560 /* Build configuration list for PBXNativeTarget "Catalyst Grid App" */ = { 433 | isa = XCConfigurationList; 434 | buildConfigurations = ( 435 | B07B4C44270F68B700A7F560 /* Debug */, 436 | B07B4C45270F68B700A7F560 /* Release */, 437 | ); 438 | defaultConfigurationIsVisible = 0; 439 | defaultConfigurationName = Release; 440 | }; 441 | /* End XCConfigurationList section */ 442 | }; 443 | rootObject = B07B4C25270F68B700A7F560 /* Project object */; 444 | } 445 | -------------------------------------------------------------------------------- /Catalyst Grid App.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Catalyst Grid App.xcodeproj/xcshareddata/xcschemes/Catalyst Grid App.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 57 | 58 | 59 | 60 | 66 | 68 | 74 | 75 | 76 | 77 | 79 | 80 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Catalyst Grid App/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 | } -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-120.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-152.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-167.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-180.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-58.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-60.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-80.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon-87.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steventroughtonsmith/catalystgridapp/6b41b2a21c8fcd3de8b84593a125c8be45e0abbf/Catalyst Grid App/Assets.xcassets/AppIcon.appiconset/icon20.png -------------------------------------------------------------------------------- /Catalyst Grid App/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Catalyst Grid App/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 | -------------------------------------------------------------------------------- /Catalyst Grid App/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).CGASceneDelegate 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 | -------------------------------------------------------------------------------- /Catalyst Grid App/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | Catalyst Grid App 4 | 5 | Created by Steven Troughton-Smith on 07/10/2021. 6 | 7 | */ 8 | 9 | "BACK" = "Back"; 10 | "MENU_VIEW_GO_BACK" = "Go Back"; 11 | 12 | "INSPECTOR_SECTION_ITEM" = "Item"; 13 | "INSPECTOR_SECTION_ITEM_NAME" = "Name"; 14 | "INSPECTOR_SECTION_ITEM_NAME_PLACEHOLDER" = "Name"; 15 | 16 | "INSPECTOR_SECTION_SOUND" = "Volume"; 17 | 18 | "INSPECTOR_SECTION_SETTINGS" = "Options"; 19 | "INSPECTOR_SECTION_SETTINGS_LOOP" = "Loop"; 20 | "INSPECTOR_SECTION_SETTINGS_SOLO" = "Solo"; 21 | "INSPECTOR_SECTION_SETTINGS_FADEIN" = "Fade In"; 22 | "INSPECTOR_SECTION_SETTINGS_FADEOUT" = "Fade Out"; 23 | 24 | "INSPECTOR_SECTION_COLOR" = "Color"; 25 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Application/CGAAppDelegate+MenuBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGAAppDelegate+NSToolbar.swift 3 | // Catalyst Grid App 4 | // 5 | // Created by Steven Troughton-Smith on 07/10/2021. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | extension CGAAppDelegate { 12 | 13 | override func buildMenu(with builder: UIMenuBuilder) { 14 | if builder.system == UIMenuSystem.context { 15 | return 16 | } 17 | 18 | super.buildMenu(with: builder) 19 | 20 | builder.remove(menu: .format) 21 | builder.remove(menu: .toolbar) 22 | builder.remove(menu: .newScene) 23 | 24 | /* Add 'Back' option to View menu */ 25 | do { 26 | let command = UIKeyCommand(input: "[", modifierFlags: [.command], action: NSSelectorFromString("goBack:")) 27 | command.title = NSLocalizedString("MENU_VIEW_GO_BACK", comment: "") 28 | command.discoverabilityTitle = NSLocalizedString("MENU_VIEW_GO_BACK", comment: "") 29 | 30 | let menu = UIMenu(identifier: UIMenu.Identifier("GoBack"), options: .displayInline, children: [command]) 31 | 32 | builder.insertChild(menu, atStartOfMenu: .view) 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Application/CGAAppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGAAppDelegate.swift 3 | // Catalyst Grid App 4 | // 5 | // Created by Steven Troughton-Smith on 07/10/2021. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class CGAAppDelegate: UIResponder, UIApplicationDelegate { 13 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 14 | return true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Application/CGASceneDelegate+NSToolbar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGASceneDelegate+NSToolbar.swift 3 | // Catalyst Grid App 4 | // 5 | // Created by Steven Troughton-Smith on 07/10/2021. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | #if targetEnvironment(macCatalyst) 12 | import AppKit 13 | 14 | extension NSToolbarItem.Identifier { 15 | static let back = NSToolbarItem.Identifier("com.example.back") 16 | } 17 | 18 | extension CGASceneDelegate: NSToolbarDelegate { 19 | 20 | func toolbarItems() -> [NSToolbarItem.Identifier] { 21 | return [.back] 22 | } 23 | 24 | func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { 25 | return toolbarItems() 26 | } 27 | 28 | func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { 29 | return toolbarItems() 30 | } 31 | 32 | func toolbar(_ toolbar: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar flag: Bool) -> NSToolbarItem? { 33 | if itemIdentifier == .back { 34 | 35 | let barItem = UIBarButtonItem(image: UIImage(systemName: "chevron.left"), style: .plain, target: mainVC, action: NSSelectorFromString("goBack:")) 36 | /* 37 | NSToolbarItemGroup does not auto-enable/disable buttons based on the responder chain, so we need an NSToolbarItem here instead 38 | */ 39 | 40 | let item = NSToolbarItem(itemIdentifier: itemIdentifier, barButtonItem: barItem) 41 | 42 | item.label = NSLocalizedString("BACK", comment: "") 43 | item.toolTip = NSLocalizedString("BACK", comment: "") 44 | item.isBordered = true 45 | item.isNavigational = true 46 | 47 | return item 48 | } 49 | 50 | return NSToolbarItem(itemIdentifier: itemIdentifier) 51 | } 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Application/CGASceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGASceneDelegate.swift 3 | // Catalyst Grid App 4 | // 5 | // Created by Steven Troughton-Smith on 07/10/2021. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | class CGASceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | var window: UIWindow? 13 | let mainVC = CGAMainViewController() 14 | 15 | func buildPrimaryUI() { 16 | 17 | guard let window = window, let windowScene = window.windowScene else { return } 18 | 19 | let svc = UISplitViewController(style: .doubleColumn) 20 | 21 | let sidebarVC = CGASidebarSourceListViewController() 22 | mainVC.sceneDelegate = self 23 | 24 | svc.viewControllers = [sidebarVC, mainVC] 25 | svc.primaryBackgroundStyle = .sidebar 26 | 27 | window.rootViewController = svc 28 | 29 | #if targetEnvironment(macCatalyst) 30 | 31 | svc.preferredPrimaryColumnWidth = UIFloat(260) 32 | 33 | sidebarVC.navigationController?.isNavigationBarHidden = true 34 | mainVC.navigationController?.isNavigationBarHidden = true 35 | 36 | let toolbar = NSToolbar(identifier: NSToolbar.Identifier("CGASceneDelegate.Toolbar")) 37 | toolbar.delegate = self 38 | toolbar.displayMode = .iconOnly 39 | toolbar.allowsUserCustomization = false 40 | 41 | windowScene.titlebar?.toolbar = toolbar 42 | windowScene.titlebar?.toolbarStyle = .unified 43 | 44 | #endif 45 | } 46 | 47 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 48 | guard let windowScene = scene as? UIWindowScene else { 49 | fatalError("Expected scene of type UIWindowScene but got an unexpected type") 50 | } 51 | window = UIWindow(windowScene: windowScene) 52 | 53 | if let window = window { 54 | 55 | buildPrimaryUI() 56 | window.makeKeyAndVisible() 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Custom Views/SBAHairlineDividerView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PSTLHairlineDividerView.swift 3 | // Pastel 4 | // 5 | // Created by Steven Troughton-Smith on 31/08/2021. 6 | // Copyright © 2021 Steven Troughton-Smith. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIRectEdge { 12 | static let centeredVertically = UIRectEdge.init(rawValue:99) 13 | static let centeredHorizontally = UIRectEdge.init(rawValue:100) 14 | } 15 | 16 | class SBAHairlineDividerView: UIView { 17 | 18 | @objc var dividerColor = UIColor.clear { 19 | didSet { 20 | setNeedsDisplay() 21 | } 22 | } 23 | 24 | var borderMask:UIRectEdge = [] 25 | 26 | override func draw(_ rect: CGRect) { 27 | let dividerWidth = UIFloat(1) 28 | 29 | if backgroundColor != nil && backgroundColor != .clear { 30 | backgroundColor?.set() 31 | UIRectFill(bounds) 32 | } 33 | 34 | if dividerColor != .clear { 35 | dividerColor.set() 36 | 37 | if borderMask.contains(.top) == true { 38 | UIRectFill(CGRect(x: 0, y: 0, width: bounds.width, height: dividerWidth)) 39 | } 40 | 41 | if borderMask.contains(.left) == true { 42 | UIRectFill(CGRect(x: 0, y: 0, width: dividerWidth, height: bounds.height)) 43 | } 44 | 45 | if borderMask.contains(.bottom) == true { 46 | UIRectFill(CGRect(x: 0, y: bounds.height-dividerWidth, width: bounds.width, height: dividerWidth)) 47 | } 48 | 49 | if borderMask.contains(.right) == true { 50 | UIRectFill(CGRect(x: bounds.width-dividerWidth, y: 0, width: dividerWidth, height: bounds.height)) 51 | } 52 | 53 | if borderMask.contains(.centeredVertically) == true { 54 | UIRectFill(CGRect(x: bounds.midX-dividerWidth, y: 0, width: dividerWidth, height: bounds.height)) 55 | } 56 | 57 | if borderMask.contains(.centeredHorizontally) == true { 58 | UIRectFill(CGRect(x: 0, y: bounds.midY-dividerWidth, width: bounds.width, height: dividerWidth)) 59 | } 60 | } 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Custom Views/SBAVisualEffectView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MRDVisualEffectView.swift 3 | // MobileRadio 4 | // 5 | // Created by Steven Troughton-Smith on 13/09/2020. 6 | // Copyright © 2020 High Caffeine Content. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SBAVisualEffectView: UIVisualEffectView { 12 | 13 | let contentEffectView:UIVisualEffectView 14 | 15 | init(blurStyle: UIBlurEffect.Style) { 16 | let blurEffect = UIBlurEffect(style: blurStyle) 17 | let vibrancyEffect = UIVibrancyEffect(blurEffect: blurEffect) 18 | 19 | contentEffectView = UIVisualEffectView(effect: vibrancyEffect) 20 | super.init(effect: blurEffect) 21 | 22 | contentView.addSubview(contentEffectView) 23 | } 24 | 25 | init(blurStyle: UIBlurEffect.Style, blur2Style: UIBlurEffect.Style) { 26 | let blurEffect = UIBlurEffect(style: blurStyle) 27 | let blur2Effect = UIBlurEffect(style: blur2Style) 28 | let vibrancyEffect = UIVibrancyEffect(blurEffect: blur2Effect) 29 | 30 | contentEffectView = UIVisualEffectView(effect: vibrancyEffect) 31 | super.init(effect: blurEffect) 32 | 33 | contentView.addSubview(contentEffectView) 34 | } 35 | 36 | init() 37 | { 38 | contentEffectView = UIVisualEffectView(effect: nil) 39 | super.init(effect: nil) 40 | contentView.addSubview(contentEffectView) 41 | } 42 | 43 | required init?(coder: NSCoder) { 44 | fatalError("init(coder:) has not been implemented") 45 | } 46 | 47 | @objc func addContentView(_ view: UIView) { 48 | contentEffectView.contentView.addSubview(view) 49 | } 50 | 51 | override func layoutSubviews() { 52 | contentEffectView.frame = bounds 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Main/CGAInspectorViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGAInspectorViewController.swift 3 | // CGAInspectorViewController 4 | // 5 | // Created by Steven Troughton-Smith on 09/09/2021. 6 | // 7 | 8 | import UIKit 9 | import SwiftUI 10 | 11 | 12 | struct HIBorderedTextFieldView: UIViewRepresentable { 13 | typealias UIViewType = UITextField 14 | let view = UITextField() 15 | 16 | var placeholder = "" 17 | var borderStyle = UITextField.BorderStyle.none 18 | 19 | func makeUIView(context: Context) -> UIViewType { 20 | return view 21 | } 22 | 23 | func updateUIView(_ uiView: UIViewType, context: Context) { 24 | view.placeholder = NSLocalizedString(placeholder, comment: "") 25 | view.borderStyle = borderStyle 26 | 27 | view.setContentHuggingPriority(.required, for: .vertical) 28 | } 29 | } 30 | 31 | struct Swatch: View { 32 | let color: Color 33 | 34 | var body: some View { 35 | Circle() 36 | .fill(color) 37 | .frame(width: UIFloat(20), height: UIFloat(20)) 38 | } 39 | } 40 | 41 | struct ContentView: View { 42 | 43 | @State var a = true 44 | @State var b = false 45 | @State var c = false 46 | @State var d = 75.0 47 | 48 | var body: some View { 49 | ScrollView { 50 | VStack(alignment:.leading) { 51 | Text("INSPECTOR_SECTION_ITEM") 52 | .font(.system(size: UIFloat(16), weight: .bold, design: .default)) 53 | .foregroundColor(.secondary) 54 | .frame(maxWidth:.infinity, alignment: .leading) 55 | 56 | HStack { 57 | Text("INSPECTOR_SECTION_ITEM_NAME") 58 | .font(.caption) 59 | 60 | HIBorderedTextFieldView(placeholder:"INSPECTOR_SECTION_ITEM_NAME_PLACEHOLDER", borderStyle: supportsMacIdiom ? .bezel : .roundedRect) 61 | .frame(maxWidth:.infinity) 62 | } 63 | 64 | Group { 65 | Divider() 66 | .padding(.vertical, UIFloat(13)) 67 | 68 | Text("INSPECTOR_SECTION_SOUND") 69 | .font(.system(size: UIFloat(16), weight: .bold, design: .default)) 70 | .foregroundColor(.secondary) 71 | .frame(maxWidth:.infinity, alignment: .leading) 72 | 73 | 74 | HStack { 75 | Slider(value: $d, in: 0 ... 100, minimumValueLabel: Image(systemName:"speaker.wave.3.fill"), maximumValueLabel: nil, label: { 76 | Text("Volume") 77 | }) 78 | .font(.caption) 79 | .foregroundColor(.secondary) 80 | 81 | Text(String(format:"%.0f%%", d)) 82 | .font(.caption) 83 | .frame(width: UIFloat(35), alignment: .trailing) 84 | } 85 | 86 | VStack(alignment:.leading) { 87 | Toggle("INSPECTOR_SECTION_SETTINGS_FADEIN", isOn: $c) 88 | Toggle("INSPECTOR_SECTION_SETTINGS_FADEOUT", isOn: $c) 89 | } 90 | .font(.caption) 91 | } 92 | 93 | Divider() 94 | .padding(.vertical, UIFloat(13)) 95 | 96 | Text("INSPECTOR_SECTION_SETTINGS") 97 | .font(.system(size: UIFloat(16), weight: .bold, design: .default)) 98 | .foregroundColor(.secondary) 99 | .frame(maxWidth:.infinity, alignment: .leading) 100 | 101 | VStack(alignment:.leading) { 102 | Toggle("INSPECTOR_SECTION_SETTINGS_LOOP", isOn: $a) 103 | Toggle("INSPECTOR_SECTION_SETTINGS_SOLO", isOn: $b) 104 | 105 | } 106 | .font(.caption) 107 | 108 | Divider() 109 | .padding(.vertical, UIFloat(13)) 110 | 111 | Text("INSPECTOR_SECTION_COLOR") 112 | .font(.system(size: UIFloat(16), weight: .bold, design: .default)) 113 | .foregroundColor(.secondary) 114 | .frame(maxWidth:.infinity, alignment: .leading) 115 | 116 | HStack { 117 | Swatch(color:.red) 118 | Swatch(color:.green) 119 | Swatch(color:.blue) 120 | Swatch(color:.purple) 121 | Swatch(color:.orange) 122 | Swatch(color:.gray) 123 | } 124 | 125 | Spacer(minLength: 0) 126 | 127 | } 128 | .frame(maxWidth:.infinity, maxHeight: .infinity) 129 | .padding(UIFloat(13)) 130 | } 131 | } 132 | } 133 | 134 | class CGAInspectorViewController: UIViewController { 135 | let hostingController = UIHostingController(rootView: ContentView()) 136 | 137 | override func loadView() { 138 | let view = SBAVisualEffectView(blurStyle: .systemChromeMaterial) 139 | 140 | #if !targetEnvironment(macCatalyst) 141 | view.contentView.backgroundColor = .systemGroupedBackground 142 | #endif 143 | 144 | let dividerView = SBAHairlineDividerView() 145 | dividerView.autoresizingMask = [.flexibleHeight, .flexibleWidth] 146 | dividerView.dividerColor = .separator 147 | dividerView.borderMask = .left 148 | dividerView.backgroundColor = .clear 149 | 150 | view.contentView.addSubview(dividerView) 151 | 152 | hostingController.view.backgroundColor = .clear 153 | view.contentView.addSubview(hostingController.view) 154 | 155 | self.view = view 156 | } 157 | 158 | override func viewDidLayoutSubviews() { 159 | super.viewDidLayoutSubviews() 160 | 161 | hostingController.view.frame = view.bounds.inset(by: view.safeAreaInsets) 162 | } 163 | 164 | // MARK: - Focus Support 165 | 166 | override func shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool { 167 | /* 168 | SwiftUI is not currently a good keyboard focus citizen, so for the 169 | purpose of this example, disable tabbing to the inspector sidebar 170 | */ 171 | return false 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Main/CGAMainViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGAMainViewController.swift 3 | // Catalyst Grid App 4 | // 5 | // Created by Steven Troughton-Smith on 07/10/2021. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | final class CGAMainViewController: UIViewController, UINavigationControllerDelegate { 12 | 13 | let gridVC = CGAGridViewController() 14 | let inspectorVC = CGAInspectorViewController() 15 | var gridNC:UINavigationController! 16 | 17 | var sceneDelegate:CGASceneDelegate? 18 | 19 | init() { 20 | super.init(nibName: nil, bundle: nil) 21 | 22 | gridNC = UINavigationController(rootViewController: gridVC) 23 | 24 | gridNC.delegate = self 25 | 26 | #if targetEnvironment(macCatalyst) 27 | gridNC.isNavigationBarHidden = true 28 | #endif 29 | 30 | addChild(gridNC) 31 | addChild(inspectorVC) 32 | 33 | view.addSubview(gridNC.view) 34 | view.addSubview(inspectorVC.view) 35 | } 36 | 37 | required init?(coder aDecoder: NSCoder) { 38 | fatalError("init(coder:) has not been implemented") 39 | } 40 | 41 | // MARK: Responder Chain - 42 | 43 | override var canBecomeFirstResponder: Bool { 44 | return true 45 | } 46 | 47 | override func responds(to aSelector: Selector!) -> Bool { 48 | 49 | /* 50 | This is the magic that determines whether the back button is enabled/disabled 51 | */ 52 | 53 | if aSelector == #selector(goBack(_:)) { 54 | return (gridNC.viewControllers.count > 1) ? true : false 55 | } 56 | 57 | return super.responds(to: aSelector) 58 | } 59 | 60 | @objc func goBack(_ sender:Any) { 61 | gridNC.popViewController(animated: true) 62 | } 63 | 64 | // MARK: Layout - 65 | 66 | override func viewDidLayoutSubviews() { 67 | super.viewDidLayoutSubviews() 68 | 69 | var inspectorWidth = UIFloat(260) 70 | 71 | /* Hide the inspector sidebar if the view gets too small */ 72 | if view.bounds.width < (inspectorWidth*2) { 73 | inspectorWidth = 0 74 | } 75 | 76 | let division = view.bounds.divided(atDistance: inspectorWidth, from: .maxXEdge) 77 | 78 | inspectorVC.view.frame = division.slice 79 | gridNC.view.frame = division.remainder 80 | } 81 | 82 | // MARK: Navigation (macOS) - 83 | 84 | /* On macOS, change the window title to match the navigation controller's current item */ 85 | func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { 86 | #if targetEnvironment(macCatalyst) 87 | guard let sceneDelegate = sceneDelegate else { return } 88 | 89 | sceneDelegate.window?.windowScene?.title = viewController.title 90 | 91 | #endif 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Main/CGASidebarSourceListViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGASidebarSourceListViewController.swift 3 | // CGASidebarSourceListViewController 4 | // 5 | // Created by Steven Troughton-Smith on 14/09/2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class CGASidebarSourceListViewController: UICollectionViewController { 11 | 12 | enum HIOutlineSection { 13 | case favorites 14 | case folders 15 | } 16 | 17 | struct HIOutlineItem: Hashable { 18 | var title: String = "" 19 | var indentation = 0 20 | var subitems: [HIOutlineItem] = [] 21 | 22 | func hash(into hasher: inout Hasher) { 23 | hasher.combine(identifier) 24 | } 25 | static func == (lhs: HIOutlineItem, rhs: HIOutlineItem) -> Bool { 26 | return lhs.identifier == rhs.identifier 27 | } 28 | private let identifier = UUID() 29 | } 30 | 31 | var dataSource: UICollectionViewDiffableDataSource! = nil 32 | 33 | init() { 34 | var listConfiguration = UICollectionLayoutListConfiguration(appearance: .sidebar) 35 | listConfiguration.showsSeparators = false 36 | 37 | let layout = UICollectionViewCompositionalLayout.list(using: listConfiguration) 38 | 39 | super.init(collectionViewLayout: layout) 40 | 41 | configureDataSource() 42 | } 43 | 44 | required init?(coder: NSCoder) { 45 | fatalError("init(coder:) has not been implemented") 46 | } 47 | 48 | // MARK: Data Source - 49 | 50 | func configureDataSource() { 51 | 52 | let cellRegistration = UICollectionView.CellRegistration { cell, indexPath, menuItem in 53 | 54 | var contentConfiguration = cell.defaultContentConfiguration() 55 | var disclosureOptions = UICellAccessory.OutlineDisclosureOptions(style: .cell) 56 | 57 | if indexPath.item == 0 { 58 | disclosureOptions = UICellAccessory.OutlineDisclosureOptions(style: .header) 59 | contentConfiguration = UIListContentConfiguration.sidebarHeader() 60 | } 61 | else { 62 | contentConfiguration.textProperties.font = .preferredFont(forTextStyle: .body) 63 | contentConfiguration.imageProperties.reservedLayoutSize = CGSize(width: UIFloat(22), height: 0) 64 | } 65 | 66 | if indexPath.section == 0 { 67 | if indexPath.row == 1 { 68 | contentConfiguration.image = UIImage(systemName: "tray") 69 | } 70 | else if indexPath.row == 2 { 71 | contentConfiguration.image = UIImage(systemName: "clock") 72 | } 73 | } 74 | else { 75 | if indexPath.row > 0 { 76 | contentConfiguration.image = UIImage(systemName: "folder") 77 | } 78 | } 79 | 80 | contentConfiguration.text = menuItem.title 81 | 82 | if indexPath.section == 1 { 83 | 84 | if menuItem.subitems.isEmpty == true { 85 | disclosureOptions.isHidden = true 86 | } 87 | else { 88 | disclosureOptions.isHidden = false 89 | } 90 | cell.accessories = [.outlineDisclosure(options: disclosureOptions)] 91 | 92 | cell.indentationLevel = menuItem.indentation 93 | } 94 | 95 | cell.contentConfiguration = contentConfiguration 96 | } 97 | 98 | dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { 99 | (collectionView: UICollectionView, indexPath: IndexPath, item: HIOutlineItem) -> UICollectionViewCell? in 100 | 101 | return collectionView.dequeueConfiguredReusableCell(using: cellRegistration, for: indexPath, item: item) 102 | } 103 | 104 | collectionView.dataSource = dataSource 105 | 106 | refresh() 107 | } 108 | 109 | // MARK: - 110 | 111 | private lazy var menuItems: [HIOutlineItem] = { 112 | return [ 113 | 114 | HIOutlineItem(title: "Folders", subitems: [ 115 | HIOutlineItem(title: "Folder A", indentation: 0), 116 | HIOutlineItem(title: "Folder B", indentation: 0, subitems: [HIOutlineItem(title: "Folder C", indentation: 1, subitems: [])]) 117 | ]) 118 | 119 | ] 120 | }() 121 | 122 | private lazy var favoriteItems: [HIOutlineItem] = { 123 | return [ 124 | HIOutlineItem(title: "Favorites", subitems: [ 125 | HIOutlineItem(title: "All"), 126 | HIOutlineItem(title: "Recents") 127 | ]), 128 | 129 | ] 130 | }() 131 | 132 | func initialSnapshot(forItems:[HIOutlineItem]) -> NSDiffableDataSourceSectionSnapshot { 133 | var snapshot = NSDiffableDataSourceSectionSnapshot() 134 | 135 | func addItems(_ menuItems: [HIOutlineItem], to parent: HIOutlineItem?) { 136 | snapshot.append(menuItems, to: parent) 137 | snapshot.expand(menuItems) 138 | for menuItem in menuItems where !menuItem.subitems.isEmpty { 139 | addItems(menuItem.subitems, to: menuItem) 140 | } 141 | } 142 | 143 | addItems(forItems, to: nil) 144 | 145 | return snapshot 146 | } 147 | 148 | func refresh() { 149 | guard let dataSource = collectionView.dataSource as? UICollectionViewDiffableDataSource else { return } 150 | 151 | dataSource.apply(initialSnapshot(forItems: favoriteItems), to: .favorites, animatingDifferences: false) 152 | dataSource.apply(initialSnapshot(forItems: menuItems), to: .folders, animatingDifferences: false) 153 | 154 | DispatchQueue.main.async { 155 | self.collectionView.selectItem(at: IndexPath(item: 1, section: 0), animated: false, scrollPosition: []) 156 | } 157 | } 158 | 159 | // MARK: - Focus Support 160 | 161 | override func collectionView(_ collectionView: UICollectionView, canFocusItemAt indexPath: IndexPath) -> Bool { 162 | 163 | /* Don't focus the favorites group header */ 164 | if indexPath.section == 0 && indexPath.row == 0 { 165 | return false 166 | } 167 | 168 | return true 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Main/Grid View/CGAGridViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGAGridViewCell.swift 3 | // Catalyst Grid App 4 | // 5 | // Created by Steven Troughton-Smith on 07/10/2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class CGAGridViewCell: UICollectionViewCell { 11 | 12 | /* 13 | Custom subviews go here, add to the content view, then lay them out in layoutSubviews 14 | */ 15 | 16 | override init(frame: CGRect) { 17 | super.init(frame: frame) 18 | 19 | contentView.backgroundColor = .systemFill 20 | 21 | contentView.layer.cornerCurve = .continuous 22 | contentView.layer.cornerRadius = UIFloat(8) 23 | 24 | contentView.layer.borderWidth = UIFloat(0.5) 25 | contentView.layer.borderColor = UIColor.separator.cgColor 26 | 27 | layer.shadowRadius = UIFloat(2) 28 | layer.shadowColor = UIColor.black.cgColor 29 | layer.shadowOpacity = 0.3 30 | layer.shadowOffset = CGSize(width: 0, height: UIFloat(1)) 31 | } 32 | 33 | required init?(coder: NSCoder) { 34 | fatalError("init(coder:) has not been implemented") 35 | } 36 | 37 | // MARK: Layout - 38 | 39 | override func layoutSubviews() { 40 | super.layoutSubviews() // Always call super 41 | 42 | if #available(macCatalyst 15.0, iOS 15.0, *) { 43 | let effect = UIFocusHaloEffect(roundedRect: bounds, cornerRadius: contentView.layer.cornerRadius, curve: contentView.layer.cornerCurve) 44 | focusEffect = effect 45 | } 46 | } 47 | 48 | // MARK: Trait Changes - 49 | 50 | override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { 51 | super.traitCollectionDidChange(previousTraitCollection) 52 | 53 | /* CALayer color properties don't automatically update when Light/Dark mode changes */ 54 | contentView.layer.borderColor = UIColor.separator.cgColor 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Main/Grid View/CGAGridViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGAGridViewController.swift 3 | // Catalyst Grid App 4 | // 5 | // Created by Steven Troughton-Smith on 07/10/2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class CGAGridViewController: UICollectionViewController { 11 | 12 | let reuseIdentifier = "Cell" 13 | let padding = UIFloat(13) 14 | 15 | enum HIGridSection { 16 | case main 17 | } 18 | 19 | struct HIGridItem: Hashable { 20 | var title: String = "" 21 | 22 | func hash(into hasher: inout Hasher) { 23 | hasher.combine(identifier) 24 | } 25 | static func == (lhs: HIGridItem, rhs: HIGridItem) -> Bool { 26 | return lhs.identifier == rhs.identifier 27 | } 28 | private let identifier = UUID() 29 | } 30 | 31 | var dataSource: UICollectionViewDiffableDataSource! = nil 32 | 33 | init() { 34 | let layout = UICollectionViewFlowLayout() 35 | 36 | super.init(collectionViewLayout: layout) 37 | 38 | guard let collectionView = collectionView else { return } 39 | 40 | title = "Root" 41 | 42 | collectionView.backgroundColor = .systemBackground 43 | collectionView.contentInset = UIEdgeInsets(top: padding, left: padding, bottom: padding, right: padding) 44 | collectionView.register(CGAGridViewCell.self, forCellWithReuseIdentifier: reuseIdentifier) 45 | 46 | configureDataSource() 47 | } 48 | 49 | required init?(coder: NSCoder) { 50 | fatalError("init(coder:) has not been implemented") 51 | } 52 | 53 | // MARK: Data Source - 54 | 55 | func configureDataSource() { 56 | 57 | dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { 58 | (collectionView: UICollectionView, indexPath: IndexPath, item: HIGridItem) -> UICollectionViewCell? in 59 | 60 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: self.reuseIdentifier, for: indexPath) 61 | 62 | /* 63 | Customize cell here 64 | */ 65 | 66 | return cell 67 | } 68 | 69 | collectionView.dataSource = dataSource 70 | 71 | refresh() 72 | } 73 | 74 | 75 | func initialSnapshot() -> NSDiffableDataSourceSectionSnapshot { 76 | var snapshot = NSDiffableDataSourceSectionSnapshot() 77 | 78 | /* Just some dummy items to populate the grid */ 79 | for _ in 0 ..< 10 { 80 | let items = [HIGridItem()] 81 | snapshot.append(items) 82 | } 83 | 84 | return snapshot 85 | } 86 | 87 | func refresh() { 88 | guard let dataSource = collectionView.dataSource as? UICollectionViewDiffableDataSource else { return } 89 | 90 | dataSource.apply(initialSnapshot(), to: .main, animatingDifferences: false) 91 | } 92 | 93 | // MARK: Manual Layout Sizing (Fast) - 94 | 95 | override func viewDidLayoutSubviews() { 96 | super.viewDidLayoutSubviews() 97 | 98 | var columns = 4 99 | let threshold = UIFloat(200) 100 | 101 | guard let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout else { return } 102 | 103 | while view.bounds.size.width/CGFloat(columns) > threshold 104 | { 105 | columns += 1 106 | } 107 | 108 | let frame = view.bounds.inset(by: collectionView.contentInset) 109 | 110 | let itemSize = (frame.width - padding*CGFloat(columns-1)) / CGFloat(columns) 111 | 112 | layout.itemSize = CGSize(width: itemSize, height: itemSize) 113 | layout.minimumLineSpacing = padding 114 | layout.minimumInteritemSpacing = 0 115 | } 116 | 117 | // MARK: - 118 | 119 | override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 120 | 121 | let vc = CGAGridViewController() 122 | vc.title = "Child" 123 | 124 | navigationController?.pushViewController(vc, animated: true) 125 | 126 | 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /Catalyst Grid App/Source/Number+Scaling.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGFloat+Scaling.swift 3 | // Voxcaster 4 | // 5 | // Created by Steven Troughton-Smith on 29/07/2020. 6 | // 7 | 8 | import UIKit 9 | 10 | public let supportsMacIdiom = !(UIDevice.current.userInterfaceIdiom == .pad) 11 | 12 | @inlinable func UIFloat(_ value: CGFloat) -> CGFloat 13 | { 14 | #if targetEnvironment(macCatalyst) 15 | return (value == 0.5) ? 0.5 : round(value * (supportsMacIdiom ? 0.77 : 1.0)) 16 | #else 17 | return value 18 | #endif 19 | } 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Catalyst Grid App 2 | 3 | Simple Catalyst example (Mac idiom) of a grid-based app with a push/pop navigation stack. Includes back button in toolbar that auto-enables based on navigation status, and a window title that matches the navigated-to view controller. 4 | 5 | Also demonstrates a mixed-style outline sidebar with collapsible sections, and a SwiftUI-based inspector panel that uses the wallpaper-hinted macOS window background color. 6 | 7 | ### Screenshots 8 | 9 | ![](https://hccdata.s3.us-east-1.amazonaws.com/gh_gridapp.jpg) 10 | --------------------------------------------------------------------------------