├── CustomCollectionViewLayout.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── donnywals.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── donnywals.xcuserdatad │ └── xcschemes │ ├── CustomCollectionViewLayout.xcscheme │ └── xcschememanagement.plist ├── CustomCollectionViewLayout ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── CustomCollectionViewCell.swift ├── CustomCollectionViewCell.xib ├── CustomCollectionviewLayout.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── cat_0.imageset │ │ ├── Contents.json │ │ ├── cat_10-1-1.jpg │ │ ├── cat_10-1.jpg │ │ └── cat_10.jpg │ ├── cat_1.imageset │ │ ├── Contents.json │ │ ├── cat_1-1-1.jpg │ │ ├── cat_1-1.jpg │ │ └── cat_1.jpg │ ├── cat_2.imageset │ │ ├── Contents.json │ │ ├── cat_2-1-1.jpg │ │ ├── cat_2-1.jpg │ │ └── cat_2.jpg │ ├── cat_3.imageset │ │ ├── Contents.json │ │ ├── cat_3-1-1.jpg │ │ ├── cat_3-1.jpg │ │ └── cat_3.jpg │ ├── cat_4.imageset │ │ ├── Contents.json │ │ ├── cat_4-1-1.jpg │ │ ├── cat_4-1.jpg │ │ └── cat_4.jpg │ ├── cat_5.imageset │ │ ├── Contents.json │ │ ├── cat_5-1-1.jpg │ │ ├── cat_5-1.jpg │ │ └── cat_5.jpg │ ├── cat_6.imageset │ │ ├── Contents.json │ │ ├── cat_6-1-1.jpg │ │ ├── cat_6-1.jpg │ │ └── cat_6.jpg │ ├── cat_7.imageset │ │ ├── Contents.json │ │ ├── cat_7-1-1.jpg │ │ ├── cat_7-1.jpg │ │ └── cat_7.jpg │ ├── cat_8.imageset │ │ ├── Contents.json │ │ ├── cat_8-1-1.jpg │ │ ├── cat_8-1.jpg │ │ └── cat_8.jpg │ └── cat_9.imageset │ │ ├── Contents.json │ │ ├── cat_9-1-1.jpg │ │ ├── cat_9-1.jpg │ │ └── cat_9.jpg ├── Info.plist └── ViewController.swift ├── CustomCollectionViewLayoutTests ├── CustomCollectionViewLayoutTests.swift └── Info.plist ├── LICENSE └── README.md /CustomCollectionViewLayout.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9768908E1B4C537F00795885 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9768908D1B4C537F00795885 /* AppDelegate.swift */; }; 11 | 976890901B4C537F00795885 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9768908F1B4C537F00795885 /* ViewController.swift */; }; 12 | 976890931B4C537F00795885 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 976890911B4C537F00795885 /* Main.storyboard */; }; 13 | 976890951B4C537F00795885 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 976890941B4C537F00795885 /* Images.xcassets */; }; 14 | 976890981B4C537F00795885 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 976890961B4C537F00795885 /* LaunchScreen.xib */; }; 15 | 976890A41B4C537F00795885 /* CustomCollectionViewLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 976890A31B4C537F00795885 /* CustomCollectionViewLayoutTests.swift */; }; 16 | 976890B01B4C540300795885 /* CustomCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 976890AF1B4C540300795885 /* CustomCollectionViewLayout.swift */; }; 17 | 976890B21B4C551800795885 /* CustomCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 976890B11B4C551800795885 /* CustomCollectionViewCell.xib */; }; 18 | 976890B41B4C567100795885 /* CustomCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 976890B31B4C567100795885 /* CustomCollectionViewCell.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 9768909E1B4C537F00795885 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 976890801B4C537F00795885 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 976890871B4C537F00795885; 27 | remoteInfo = CustomCollectionViewLayout; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 976890881B4C537F00795885 /* CustomCollectionViewLayout.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CustomCollectionViewLayout.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 9768908C1B4C537F00795885 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 9768908D1B4C537F00795885 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 35 | 9768908F1B4C537F00795885 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 36 | 976890921B4C537F00795885 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | 976890941B4C537F00795885 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | 976890971B4C537F00795885 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 39 | 9768909D1B4C537F00795885 /* CustomCollectionViewLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CustomCollectionViewLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 976890A21B4C537F00795885 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | 976890A31B4C537F00795885 /* CustomCollectionViewLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCollectionViewLayoutTests.swift; sourceTree = ""; }; 42 | 976890AF1B4C540300795885 /* CustomCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomCollectionViewLayout.swift; sourceTree = ""; }; 43 | 976890B11B4C551800795885 /* CustomCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomCollectionViewCell.xib; sourceTree = ""; }; 44 | 976890B31B4C567100795885 /* CustomCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomCollectionViewCell.swift; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 976890851B4C537F00795885 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | 9768909A1B4C537F00795885 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 9768907F1B4C537F00795885 = { 66 | isa = PBXGroup; 67 | children = ( 68 | 9768908A1B4C537F00795885 /* CustomCollectionViewLayout */, 69 | 976890A01B4C537F00795885 /* CustomCollectionViewLayoutTests */, 70 | 976890891B4C537F00795885 /* Products */, 71 | ); 72 | sourceTree = ""; 73 | }; 74 | 976890891B4C537F00795885 /* Products */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 976890881B4C537F00795885 /* CustomCollectionViewLayout.app */, 78 | 9768909D1B4C537F00795885 /* CustomCollectionViewLayoutTests.xctest */, 79 | ); 80 | name = Products; 81 | sourceTree = ""; 82 | }; 83 | 9768908A1B4C537F00795885 /* CustomCollectionViewLayout */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 9768908D1B4C537F00795885 /* AppDelegate.swift */, 87 | 9768908F1B4C537F00795885 /* ViewController.swift */, 88 | 976890911B4C537F00795885 /* Main.storyboard */, 89 | 976890941B4C537F00795885 /* Images.xcassets */, 90 | 976890961B4C537F00795885 /* LaunchScreen.xib */, 91 | 9768908B1B4C537F00795885 /* Supporting Files */, 92 | 976890AF1B4C540300795885 /* CustomCollectionViewLayout.swift */, 93 | 976890B31B4C567100795885 /* CustomCollectionViewCell.swift */, 94 | 976890B11B4C551800795885 /* CustomCollectionViewCell.xib */, 95 | ); 96 | path = CustomCollectionViewLayout; 97 | sourceTree = ""; 98 | }; 99 | 9768908B1B4C537F00795885 /* Supporting Files */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 9768908C1B4C537F00795885 /* Info.plist */, 103 | ); 104 | name = "Supporting Files"; 105 | sourceTree = ""; 106 | }; 107 | 976890A01B4C537F00795885 /* CustomCollectionViewLayoutTests */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 976890A31B4C537F00795885 /* CustomCollectionViewLayoutTests.swift */, 111 | 976890A11B4C537F00795885 /* Supporting Files */, 112 | ); 113 | path = CustomCollectionViewLayoutTests; 114 | sourceTree = ""; 115 | }; 116 | 976890A11B4C537F00795885 /* Supporting Files */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 976890A21B4C537F00795885 /* Info.plist */, 120 | ); 121 | name = "Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | /* End PBXGroup section */ 125 | 126 | /* Begin PBXNativeTarget section */ 127 | 976890871B4C537F00795885 /* CustomCollectionViewLayout */ = { 128 | isa = PBXNativeTarget; 129 | buildConfigurationList = 976890A71B4C537F00795885 /* Build configuration list for PBXNativeTarget "CustomCollectionViewLayout" */; 130 | buildPhases = ( 131 | 976890841B4C537F00795885 /* Sources */, 132 | 976890851B4C537F00795885 /* Frameworks */, 133 | 976890861B4C537F00795885 /* Resources */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = CustomCollectionViewLayout; 140 | productName = CustomCollectionViewLayout; 141 | productReference = 976890881B4C537F00795885 /* CustomCollectionViewLayout.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | 9768909C1B4C537F00795885 /* CustomCollectionViewLayoutTests */ = { 145 | isa = PBXNativeTarget; 146 | buildConfigurationList = 976890AA1B4C537F00795885 /* Build configuration list for PBXNativeTarget "CustomCollectionViewLayoutTests" */; 147 | buildPhases = ( 148 | 976890991B4C537F00795885 /* Sources */, 149 | 9768909A1B4C537F00795885 /* Frameworks */, 150 | 9768909B1B4C537F00795885 /* Resources */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | 9768909F1B4C537F00795885 /* PBXTargetDependency */, 156 | ); 157 | name = CustomCollectionViewLayoutTests; 158 | productName = CustomCollectionViewLayoutTests; 159 | productReference = 9768909D1B4C537F00795885 /* CustomCollectionViewLayoutTests.xctest */; 160 | productType = "com.apple.product-type.bundle.unit-test"; 161 | }; 162 | /* End PBXNativeTarget section */ 163 | 164 | /* Begin PBXProject section */ 165 | 976890801B4C537F00795885 /* Project object */ = { 166 | isa = PBXProject; 167 | attributes = { 168 | LastUpgradeCheck = 1110; 169 | ORGANIZATIONNAME = "Donny Wals"; 170 | TargetAttributes = { 171 | 976890871B4C537F00795885 = { 172 | CreatedOnToolsVersion = 6.4; 173 | }; 174 | 9768909C1B4C537F00795885 = { 175 | CreatedOnToolsVersion = 6.4; 176 | TestTargetID = 976890871B4C537F00795885; 177 | }; 178 | }; 179 | }; 180 | buildConfigurationList = 976890831B4C537F00795885 /* Build configuration list for PBXProject "CustomCollectionViewLayout" */; 181 | compatibilityVersion = "Xcode 3.2"; 182 | developmentRegion = en; 183 | hasScannedForEncodings = 0; 184 | knownRegions = ( 185 | en, 186 | Base, 187 | ); 188 | mainGroup = 9768907F1B4C537F00795885; 189 | productRefGroup = 976890891B4C537F00795885 /* Products */; 190 | projectDirPath = ""; 191 | projectRoot = ""; 192 | targets = ( 193 | 976890871B4C537F00795885 /* CustomCollectionViewLayout */, 194 | 9768909C1B4C537F00795885 /* CustomCollectionViewLayoutTests */, 195 | ); 196 | }; 197 | /* End PBXProject section */ 198 | 199 | /* Begin PBXResourcesBuildPhase section */ 200 | 976890861B4C537F00795885 /* Resources */ = { 201 | isa = PBXResourcesBuildPhase; 202 | buildActionMask = 2147483647; 203 | files = ( 204 | 976890931B4C537F00795885 /* Main.storyboard in Resources */, 205 | 976890981B4C537F00795885 /* LaunchScreen.xib in Resources */, 206 | 976890951B4C537F00795885 /* Images.xcassets in Resources */, 207 | 976890B21B4C551800795885 /* CustomCollectionViewCell.xib in Resources */, 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | 9768909B1B4C537F00795885 /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXResourcesBuildPhase section */ 219 | 220 | /* Begin PBXSourcesBuildPhase section */ 221 | 976890841B4C537F00795885 /* Sources */ = { 222 | isa = PBXSourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | 976890901B4C537F00795885 /* ViewController.swift in Sources */, 226 | 976890B01B4C540300795885 /* CustomCollectionViewLayout.swift in Sources */, 227 | 9768908E1B4C537F00795885 /* AppDelegate.swift in Sources */, 228 | 976890B41B4C567100795885 /* CustomCollectionViewCell.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | 976890991B4C537F00795885 /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 976890A41B4C537F00795885 /* CustomCollectionViewLayoutTests.swift in Sources */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | /* End PBXSourcesBuildPhase section */ 241 | 242 | /* Begin PBXTargetDependency section */ 243 | 9768909F1B4C537F00795885 /* PBXTargetDependency */ = { 244 | isa = PBXTargetDependency; 245 | target = 976890871B4C537F00795885 /* CustomCollectionViewLayout */; 246 | targetProxy = 9768909E1B4C537F00795885 /* PBXContainerItemProxy */; 247 | }; 248 | /* End PBXTargetDependency section */ 249 | 250 | /* Begin PBXVariantGroup section */ 251 | 976890911B4C537F00795885 /* Main.storyboard */ = { 252 | isa = PBXVariantGroup; 253 | children = ( 254 | 976890921B4C537F00795885 /* Base */, 255 | ); 256 | name = Main.storyboard; 257 | sourceTree = ""; 258 | }; 259 | 976890961B4C537F00795885 /* LaunchScreen.xib */ = { 260 | isa = PBXVariantGroup; 261 | children = ( 262 | 976890971B4C537F00795885 /* Base */, 263 | ); 264 | name = LaunchScreen.xib; 265 | sourceTree = ""; 266 | }; 267 | /* End PBXVariantGroup section */ 268 | 269 | /* Begin XCBuildConfiguration section */ 270 | 976890A51B4C537F00795885 /* Debug */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | ALWAYS_SEARCH_USER_PATHS = NO; 274 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 275 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 276 | CLANG_CXX_LIBRARY = "libc++"; 277 | CLANG_ENABLE_MODULES = YES; 278 | CLANG_ENABLE_OBJC_ARC = YES; 279 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 280 | CLANG_WARN_BOOL_CONVERSION = YES; 281 | CLANG_WARN_COMMA = YES; 282 | CLANG_WARN_CONSTANT_CONVERSION = YES; 283 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 284 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 285 | CLANG_WARN_EMPTY_BODY = YES; 286 | CLANG_WARN_ENUM_CONVERSION = YES; 287 | CLANG_WARN_INFINITE_RECURSION = YES; 288 | CLANG_WARN_INT_CONVERSION = YES; 289 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 290 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 291 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 292 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 293 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 294 | CLANG_WARN_STRICT_PROTOTYPES = YES; 295 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 296 | CLANG_WARN_UNREACHABLE_CODE = YES; 297 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 298 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 299 | COPY_PHASE_STRIP = NO; 300 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 301 | ENABLE_STRICT_OBJC_MSGSEND = YES; 302 | ENABLE_TESTABILITY = YES; 303 | GCC_C_LANGUAGE_STANDARD = gnu99; 304 | GCC_DYNAMIC_NO_PIC = NO; 305 | GCC_NO_COMMON_BLOCKS = YES; 306 | GCC_OPTIMIZATION_LEVEL = 0; 307 | GCC_PREPROCESSOR_DEFINITIONS = ( 308 | "DEBUG=1", 309 | "$(inherited)", 310 | ); 311 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 312 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 313 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 314 | GCC_WARN_UNDECLARED_SELECTOR = YES; 315 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 316 | GCC_WARN_UNUSED_FUNCTION = YES; 317 | GCC_WARN_UNUSED_VARIABLE = YES; 318 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 319 | MTL_ENABLE_DEBUG_INFO = YES; 320 | ONLY_ACTIVE_ARCH = YES; 321 | SDKROOT = iphoneos; 322 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 323 | }; 324 | name = Debug; 325 | }; 326 | 976890A61B4C537F00795885 /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 332 | CLANG_CXX_LIBRARY = "libc++"; 333 | CLANG_ENABLE_MODULES = YES; 334 | CLANG_ENABLE_OBJC_ARC = YES; 335 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 336 | CLANG_WARN_BOOL_CONVERSION = YES; 337 | CLANG_WARN_COMMA = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 340 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 341 | CLANG_WARN_EMPTY_BODY = YES; 342 | CLANG_WARN_ENUM_CONVERSION = YES; 343 | CLANG_WARN_INFINITE_RECURSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 347 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 348 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 349 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 350 | CLANG_WARN_STRICT_PROTOTYPES = YES; 351 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 352 | CLANG_WARN_UNREACHABLE_CODE = YES; 353 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 354 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 357 | ENABLE_NS_ASSERTIONS = NO; 358 | ENABLE_STRICT_OBJC_MSGSEND = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu99; 360 | GCC_NO_COMMON_BLOCKS = YES; 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 368 | MTL_ENABLE_DEBUG_INFO = NO; 369 | SDKROOT = iphoneos; 370 | SWIFT_COMPILATION_MODE = wholemodule; 371 | VALIDATE_PRODUCT = YES; 372 | }; 373 | name = Release; 374 | }; 375 | 976890A81B4C537F00795885 /* Debug */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 379 | INFOPLIST_FILE = CustomCollectionViewLayout/Info.plist; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | PRODUCT_BUNDLE_IDENTIFIER = com.donnywals.collectionviewlayout; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | SWIFT_VERSION = 5.0; 384 | }; 385 | name = Debug; 386 | }; 387 | 976890A91B4C537F00795885 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 391 | INFOPLIST_FILE = CustomCollectionViewLayout/Info.plist; 392 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 393 | PRODUCT_BUNDLE_IDENTIFIER = com.donnywals.collectionviewlayout; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | SWIFT_VERSION = 5.0; 396 | }; 397 | name = Release; 398 | }; 399 | 976890AB1B4C537F00795885 /* Debug */ = { 400 | isa = XCBuildConfiguration; 401 | buildSettings = { 402 | BUNDLE_LOADER = "$(TEST_HOST)"; 403 | FRAMEWORK_SEARCH_PATHS = ( 404 | "$(SDKROOT)/Developer/Library/Frameworks", 405 | "$(inherited)", 406 | ); 407 | GCC_PREPROCESSOR_DEFINITIONS = ( 408 | "DEBUG=1", 409 | "$(inherited)", 410 | ); 411 | INFOPLIST_FILE = CustomCollectionViewLayoutTests/Info.plist; 412 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 413 | PRODUCT_BUNDLE_IDENTIFIER = com.donnywals.collectionviewlayout; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | SWIFT_VERSION = 5.0; 416 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CustomCollectionViewLayout.app/CustomCollectionViewLayout"; 417 | }; 418 | name = Debug; 419 | }; 420 | 976890AC1B4C537F00795885 /* Release */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | BUNDLE_LOADER = "$(TEST_HOST)"; 424 | FRAMEWORK_SEARCH_PATHS = ( 425 | "$(SDKROOT)/Developer/Library/Frameworks", 426 | "$(inherited)", 427 | ); 428 | INFOPLIST_FILE = CustomCollectionViewLayoutTests/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 430 | PRODUCT_BUNDLE_IDENTIFIER = com.donnywals.collectionviewlayout; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | SWIFT_VERSION = 5.0; 433 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CustomCollectionViewLayout.app/CustomCollectionViewLayout"; 434 | }; 435 | name = Release; 436 | }; 437 | /* End XCBuildConfiguration section */ 438 | 439 | /* Begin XCConfigurationList section */ 440 | 976890831B4C537F00795885 /* Build configuration list for PBXProject "CustomCollectionViewLayout" */ = { 441 | isa = XCConfigurationList; 442 | buildConfigurations = ( 443 | 976890A51B4C537F00795885 /* Debug */, 444 | 976890A61B4C537F00795885 /* Release */, 445 | ); 446 | defaultConfigurationIsVisible = 0; 447 | defaultConfigurationName = Release; 448 | }; 449 | 976890A71B4C537F00795885 /* Build configuration list for PBXNativeTarget "CustomCollectionViewLayout" */ = { 450 | isa = XCConfigurationList; 451 | buildConfigurations = ( 452 | 976890A81B4C537F00795885 /* Debug */, 453 | 976890A91B4C537F00795885 /* Release */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | 976890AA1B4C537F00795885 /* Build configuration list for PBXNativeTarget "CustomCollectionViewLayoutTests" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 976890AB1B4C537F00795885 /* Debug */, 462 | 976890AC1B4C537F00795885 /* Release */, 463 | ); 464 | defaultConfigurationIsVisible = 0; 465 | defaultConfigurationName = Release; 466 | }; 467 | /* End XCConfigurationList section */ 468 | }; 469 | rootObject = 976890801B4C537F00795885 /* Project object */; 470 | } 471 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout.xcodeproj/project.xcworkspace/xcuserdata/donnywals.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout.xcodeproj/project.xcworkspace/xcuserdata/donnywals.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CustomCollectionViewLayout.xcodeproj/xcuserdata/donnywals.xcuserdatad/xcschemes/CustomCollectionViewLayout.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 76 | 78 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout.xcodeproj/xcuserdata/donnywals.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CustomCollectionViewLayout.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 976890871B4C537F00795885 16 | 17 | primary 18 | 19 | 20 | 9768909C1B4C537F00795885 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CustomCollectionViewLayout 4 | // 5 | // Created by Donny Wals on 07-07-15. 6 | // Copyright (c) 2015 Donny Wals. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | var window: UIWindow? 14 | 15 | private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 16 | return true 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Base.lproj/Main.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 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout/CustomCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomCollectionViewCell.swift 3 | // CustomCollectionViewLayout 4 | // 5 | // Created by Donny Wals on 07-07-15. 6 | // Copyright (c) 2015 Donny Wals. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CustomCollectionViewCell: UICollectionViewCell { 12 | 13 | @IBOutlet weak var imageView: UIImageView! 14 | 15 | override func awakeFromNib() { 16 | imageView.layer.cornerRadius = 40 17 | imageView.clipsToBounds = true 18 | 19 | layer.shadowColor = UIColor.black.cgColor 20 | layer.shadowOffset = CGSize(width: 0, height: 2) 21 | layer.shadowRadius = 2 22 | layer.shadowOpacity = 0.8 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout/CustomCollectionViewCell.xib: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout/CustomCollectionviewLayout.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomCollectionViewLayout.swift 3 | // CustomCollectionViewLayout 4 | // 5 | // Created by Donny Wals on 07-07-15. 6 | // Copyright (c) 2015 Donny Wals. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CustomCollectionViewLayout: UICollectionViewFlowLayout { 12 | let itemWidth: CGFloat = 80 13 | let itemSpacing: CGFloat = 15 14 | var layoutInfo = [IndexPath: UICollectionViewLayoutAttributes]() 15 | var maxXPos: CGFloat = 0 16 | 17 | override init() { 18 | super.init() 19 | setup() 20 | } 21 | 22 | required init?(coder aDecoder: NSCoder) { 23 | super.init(coder: aDecoder) 24 | setup() 25 | } 26 | 27 | func setup() { 28 | // setting up some inherited values 29 | self.itemSize = CGSize(width: itemWidth, height: itemWidth) 30 | self.minimumInteritemSpacing = itemSpacing 31 | self.minimumLineSpacing = itemSpacing 32 | self.scrollDirection = .horizontal 33 | } 34 | 35 | override func prepare() { 36 | layoutInfo = [IndexPath: UICollectionViewLayoutAttributes]() 37 | for i in (0..<(self.collectionView?.numberOfItems(inSection: 0) ?? 0)) { 38 | let indexPath = IndexPath(row: i, section: 0) 39 | let itemAttributes = UICollectionViewLayoutAttributes(forCellWith: indexPath) 40 | itemAttributes.frame = frameForItemAtIndexPath(indexPath) 41 | if itemAttributes.frame.origin.x > maxXPos { 42 | maxXPos = itemAttributes.frame.origin.x 43 | } 44 | layoutInfo[indexPath] = itemAttributes 45 | } 46 | } 47 | 48 | func frameForItemAtIndexPath(_ indexPath: IndexPath) -> CGRect { 49 | let maxHeight = self.collectionView!.frame.height - 20 50 | let numRows = floor((maxHeight+self.minimumLineSpacing)/(itemWidth+self.minimumLineSpacing)) 51 | 52 | let currentColumn = floor(CGFloat(indexPath.row)/numRows) 53 | let currentRow = CGFloat(indexPath.row).truncatingRemainder(dividingBy: numRows) 54 | 55 | let xPos = currentRow.truncatingRemainder(dividingBy: 2) == 0 ? currentColumn*(itemWidth+self.minimumInteritemSpacing) : currentColumn*(itemWidth+self.minimumInteritemSpacing)+itemWidth*0.25 56 | let yPos = currentRow*(itemWidth+self.minimumLineSpacing)+10 57 | 58 | return CGRect(x: xPos, y: yPos, width: itemWidth, height: itemWidth) 59 | } 60 | 61 | override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? { 62 | return layoutInfo[indexPath] 63 | } 64 | 65 | override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { 66 | var allAttributes: [UICollectionViewLayoutAttributes] = [UICollectionViewLayoutAttributes]() 67 | 68 | for (_, attributes) in layoutInfo { 69 | if rect.intersects(attributes.frame) { 70 | allAttributes.append(attributes) 71 | } 72 | } 73 | 74 | return allAttributes 75 | } 76 | 77 | override var collectionViewContentSize: CGSize { 78 | let collectionViewHeight = self.collectionView!.frame.height 79 | let contentWidth: CGFloat = maxXPos + itemWidth 80 | 81 | return CGSize(width: contentWidth, height: collectionViewHeight) 82 | } 83 | } 84 | 85 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_10.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_10-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_10-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_0.imageset/cat_10-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_0.imageset/cat_10-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_0.imageset/cat_10-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_0.imageset/cat_10-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_0.imageset/cat_10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_0.imageset/cat_10.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_1.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_1-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_1-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_1.imageset/cat_1-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_1.imageset/cat_1-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_1.imageset/cat_1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_1.imageset/cat_1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_1.imageset/cat_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_1.imageset/cat_1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_2.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_2-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_2-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_2.imageset/cat_2-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_2.imageset/cat_2-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_2.imageset/cat_2-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_2.imageset/cat_2-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_2.imageset/cat_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_2.imageset/cat_2.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_3.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_3-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_3-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_3.imageset/cat_3-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_3.imageset/cat_3-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_3.imageset/cat_3-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_3.imageset/cat_3-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_3.imageset/cat_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_3.imageset/cat_3.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_4.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_4-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_4-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_4.imageset/cat_4-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_4.imageset/cat_4-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_4.imageset/cat_4-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_4.imageset/cat_4-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_4.imageset/cat_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_4.imageset/cat_4.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_5.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_5-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_5-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_5.imageset/cat_5-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_5.imageset/cat_5-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_5.imageset/cat_5-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_5.imageset/cat_5-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_5.imageset/cat_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_5.imageset/cat_5.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_6.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_6-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_6-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_6.imageset/cat_6-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_6.imageset/cat_6-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_6.imageset/cat_6-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_6.imageset/cat_6-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_6.imageset/cat_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_6.imageset/cat_6.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_7.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_7-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_7-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_7.imageset/cat_7-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_7.imageset/cat_7-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_7.imageset/cat_7-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_7.imageset/cat_7-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_7.imageset/cat_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_7.imageset/cat_7.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_8.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_8-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_8-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_8.imageset/cat_8-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_8.imageset/cat_8-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_8.imageset/cat_8-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_8.imageset/cat_8-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_8.imageset/cat_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_8.imageset/cat_8.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cat_9.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cat_9-1.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cat_9-1-1.jpg" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_9.imageset/cat_9-1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_9.imageset/cat_9-1-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_9.imageset/cat_9-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_9.imageset/cat_9-1.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Images.xcassets/cat_9.imageset/cat_9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donnywals/CustomCollectionViewLayout/786b15801d275746e9c1b7da93ac591c9d07a8f9/CustomCollectionViewLayout/Images.xcassets/cat_9.imageset/cat_9.jpg -------------------------------------------------------------------------------- /CustomCollectionViewLayout/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CustomCollectionViewLayout/ViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class ViewController: UIViewController, UICollectionViewDataSource { 4 | 5 | 6 | @IBOutlet weak var collectionView: UICollectionView! 7 | 8 | private let cellIdentifier = "collectionCell" 9 | 10 | override func viewDidLoad() { 11 | super.viewDidLoad() 12 | 13 | collectionView.register(UINib(nibName: "CustomCollectionViewCell", bundle: nil), forCellWithReuseIdentifier:cellIdentifier) 14 | } 15 | 16 | func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { 17 | return 1 18 | } 19 | 20 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 21 | return 50 22 | } 23 | 24 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 25 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! CustomCollectionViewCell 26 | 27 | cell.imageView.image = UIImage(named: "cat_\(indexPath.row%10)") 28 | 29 | return cell 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /CustomCollectionViewLayoutTests/CustomCollectionViewLayoutTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomCollectionViewLayoutTests.swift 3 | // CustomCollectionViewLayoutTests 4 | // 5 | // Created by Donny Wals on 07-07-15. 6 | // Copyright (c) 2015 Donny Wals. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class CustomCollectionViewLayoutTests: XCTestCase { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /CustomCollectionViewLayoutTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Donny Wals 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CustomCollectionViewLayout 2 | A sample project to accompany a blogpost that demonstrates how to subclass UICollectionViewLayout. 3 | --------------------------------------------------------------------------------