├── .gitignore ├── CollectionViewWaterfallLayout.podspec ├── CollectionViewWaterfallLayout.swift ├── LICENSE ├── README.md ├── Screenshots ├── DemoExample.png └── RealWorldExample.png └── WaterfallDemo ├── CollectionViewWaterfallLayoutDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── WaterfallFlowLayout ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ ├── Contents.json │ │ └── Default-568h@2x.png ├── Info.plist ├── LabelCollectionViewCell.swift ├── LaunchScreen.storyboard └── ViewController.swift └── WaterfallFlowLayoutTests ├── Info.plist └── WaterfallFlowLayoutTests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | 70 | .DS_Store 71 | -------------------------------------------------------------------------------- /CollectionViewWaterfallLayout.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'CollectionViewWaterfallLayout' 3 | s.version = '0.5.0' 4 | s.summary = 'Pinterest inspired layout for UICollectionViews written in Swift' 5 | s.description = <<-DESC 6 | Custom UICollectionView layout inspired by Pinterest. It can layout multiple columns of items with different heights to create dynamic flowing cells. 7 | DESC 8 | s.homepage = 'https://github.com/ecerney/CollectionViewWaterfallLayout' 9 | s.screenshots = 'https://raw.githubusercontent.com/ecerney/CollectionViewWaterfallLayout/master/Screenshots/RealWorldExample.png', 'https://raw.githubusercontent.com/ecerney/CollectionViewWaterfallLayout/master/Screenshots/DemoExample.png' 10 | s.license = { :type => 'MIT', :file => 'LICENSE' } 11 | s.author = { 'Eric Cerney' => 'ecerney@gmail.com' } 12 | s.source = { :git => 'https://github.com/ecerney/CollectionViewWaterfallLayout.git', :tag => s.version.to_s } 13 | s.social_media_url = 'https://twitter.com/ecerney' 14 | s.ios.deployment_target = '8.0' 15 | s.swift_versions = '5.0' 16 | s.source_files = 'CollectionViewWaterfallLayout.swift' 17 | s.frameworks = 'UIKit' 18 | end 19 | -------------------------------------------------------------------------------- /CollectionViewWaterfallLayout.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewWaterfallLayout.swift 3 | // CollectionViewWaterfallLayout 4 | // 5 | // Created by Eric Cerney on 7/21/14. 6 | // Based on CHTCollectionViewWaterfallLayout by Nelson Tai 7 | // Copyright (c) 2014 Eric Cerney. All rights reserved. 8 | // 9 | 10 | import UIKit 11 | 12 | public let CollectionViewWaterfallElementKindSectionHeader = "CollectionViewWaterfallElementKindSectionHeader" 13 | public let CollectionViewWaterfallElementKindSectionFooter = "CollectionViewWaterfallElementKindSectionFooter" 14 | 15 | @objc public protocol CollectionViewWaterfallLayoutDelegate: UICollectionViewDelegate { 16 | func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize 17 | 18 | @objc optional func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, heightForHeaderInSection section: Int) -> Float 19 | 20 | @objc optional func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, heightForFooterInSection section: Int) -> Float 21 | 22 | @objc optional func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, insetForSection section: Int) -> UIEdgeInsets 23 | 24 | @objc optional func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, insetForHeaderInSection section: Int) -> UIEdgeInsets 25 | 26 | @objc optional func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, insetForFooterInSection section: Int) -> UIEdgeInsets 27 | 28 | @objc optional func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, minimumInteritemSpacingForSection section: Int) -> Float 29 | 30 | } 31 | 32 | public class CollectionViewWaterfallLayout: UICollectionViewLayout { 33 | 34 | // MARK: - Private constants 35 | /// How many items to be union into a single rectangle 36 | private let unionSize = 20 37 | 38 | // MARK: - Public Properties 39 | public var columnCount: Int = 2 { 40 | didSet { 41 | invalidateIfNotEqual(oldValue, newValue: columnCount) 42 | } 43 | } 44 | public var minimumColumnSpacing: Float = 10.0 { 45 | didSet { 46 | invalidateIfNotEqual(oldValue, newValue: minimumColumnSpacing) 47 | } 48 | } 49 | public var minimumInteritemSpacing: Float = 10.0 { 50 | didSet { 51 | invalidateIfNotEqual(oldValue, newValue: minimumInteritemSpacing) 52 | } 53 | } 54 | public var headerHeight: Float = 0.0 { 55 | didSet { 56 | invalidateIfNotEqual(oldValue, newValue: headerHeight) 57 | } 58 | } 59 | public var footerHeight: Float = 0.0 { 60 | didSet { 61 | invalidateIfNotEqual(oldValue, newValue: footerHeight) 62 | } 63 | } 64 | public var headerInset: UIEdgeInsets = .zero { 65 | didSet { 66 | invalidateIfNotEqual(oldValue, newValue: headerInset) 67 | } 68 | } 69 | public var footerInset:UIEdgeInsets = .zero { 70 | didSet { 71 | invalidateIfNotEqual(oldValue, newValue: footerInset) 72 | } 73 | } 74 | public var sectionInset:UIEdgeInsets = .zero { 75 | didSet { 76 | invalidateIfNotEqual(oldValue, newValue: sectionInset) 77 | } 78 | } 79 | 80 | public override var collectionViewContentSize: CGSize { 81 | let numberOfSections = collectionView?.numberOfSections 82 | if numberOfSections == 0 { 83 | return CGSize.zero 84 | } 85 | 86 | var contentSize = collectionView?.bounds.size 87 | contentSize?.height = CGFloat(columnHeights[0]) 88 | 89 | return contentSize! 90 | } 91 | 92 | // MARK: - Private Properties 93 | private weak var delegate: CollectionViewWaterfallLayoutDelegate? { 94 | get { 95 | return collectionView?.delegate as? CollectionViewWaterfallLayoutDelegate 96 | } 97 | } 98 | private var columnHeights = [Float]() 99 | private var sectionItemAttributes = [[UICollectionViewLayoutAttributes]]() 100 | private var allItemAttributes = [UICollectionViewLayoutAttributes]() 101 | private var headersAttribute = [Int: UICollectionViewLayoutAttributes]() 102 | private var footersAttribute = [Int: UICollectionViewLayoutAttributes]() 103 | private var unionRects = [CGRect]() 104 | 105 | // MARK: - UICollectionViewLayout Methods 106 | public override func prepare() { 107 | super.prepare() 108 | 109 | guard let numberOfSections = collectionView?.numberOfSections else { 110 | return 111 | } 112 | 113 | guard let delegate = delegate else { 114 | assertionFailure("UICollectionView's delegate should conform to WaterfallLayoutDelegate protocol") 115 | return 116 | } 117 | 118 | guard let collectionView = collectionView else { 119 | return 120 | } 121 | 122 | assert(columnCount > 0, "WaterfallFlowLayout's columnCount should be greater than 0") 123 | 124 | // Initialize variables 125 | headersAttribute.removeAll(keepingCapacity: false) 126 | footersAttribute.removeAll(keepingCapacity: false) 127 | unionRects.removeAll(keepingCapacity: false) 128 | columnHeights.removeAll(keepingCapacity: false) 129 | allItemAttributes.removeAll(keepingCapacity: false) 130 | sectionItemAttributes.removeAll(keepingCapacity: false) 131 | 132 | for _ in 0.. 0 { 161 | attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: CollectionViewWaterfallElementKindSectionHeader, with: NSIndexPath(item: 0, section: section) as IndexPath) 162 | attributes.frame = CGRect(x: headerInset.left, y: CGFloat(top), width: collectionView.frame.size.width - (headerInset.left + headerInset.right), height: CGFloat(headerHeight)) 163 | 164 | headersAttribute[section] = attributes 165 | allItemAttributes.append(attributes) 166 | 167 | top = Float(attributes.frame.maxY) + Float(headerInset.bottom) 168 | } 169 | 170 | top += Float(sectionInset.top) 171 | for idx in 0.. 0 && itemSize.width > 0 { 192 | itemHeight = Float(itemSize.height) * itemWidth / Float(itemSize.width) 193 | } 194 | 195 | attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath as IndexPath) 196 | attributes.frame = CGRect(x: CGFloat(xOffset), y: CGFloat(yOffset), width: CGFloat(itemWidth), height: CGFloat(itemHeight)) 197 | itemAttributes.append(attributes) 198 | allItemAttributes.append(attributes) 199 | columnHeights[columnIndex] = Float(attributes.frame.maxY) + minimumInteritemSpacing 200 | } 201 | 202 | sectionItemAttributes.append(itemAttributes) 203 | 204 | /* 205 | * 4. Section footer 206 | */ 207 | let columnIndex = longestColumnIndex() 208 | top = columnHeights[columnIndex] - minimumInteritemSpacing + Float(sectionInset.bottom) 209 | 210 | let footerHeight: Float = delegate.collectionView?(collectionView, layout: self, heightForFooterInSection: section) ?? self.footerHeight 211 | 212 | let footerInset: UIEdgeInsets = delegate.collectionView?(collectionView, layout: self, insetForFooterInSection: section) ?? self.footerInset 213 | 214 | top += Float(footerInset.top) 215 | 216 | if footerHeight > 0 { 217 | attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: CollectionViewWaterfallElementKindSectionFooter, with: NSIndexPath(item: 0, section: section) as IndexPath) 218 | attributes.frame = CGRect(x: footerInset.left, y: CGFloat(top), width: collectionView.frame.size.width - (footerInset.left + footerInset.right), height: CGFloat(footerHeight)) 219 | 220 | footersAttribute[section] = attributes 221 | allItemAttributes.append(attributes) 222 | 223 | top = Float(attributes.frame.maxY) + Float(footerInset.bottom) 224 | } 225 | 226 | for idx in 0.. UICollectionViewLayoutAttributes? { 245 | if indexPath.section >= sectionItemAttributes.count { 246 | return nil 247 | } 248 | 249 | if indexPath.item >= sectionItemAttributes[indexPath.section].count { 250 | return nil 251 | } 252 | 253 | return sectionItemAttributes[indexPath.section][indexPath.item] 254 | } 255 | 256 | public override func layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? { 257 | var attribute: UICollectionViewLayoutAttributes? 258 | 259 | if elementKind == CollectionViewWaterfallElementKindSectionHeader { 260 | attribute = headersAttribute[indexPath.section] 261 | } else if elementKind == CollectionViewWaterfallElementKindSectionFooter { 262 | attribute = footersAttribute[indexPath.section] 263 | } 264 | 265 | return attribute 266 | } 267 | 268 | public override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { 269 | var begin: Int = 0 270 | var end: Int = unionRects.count 271 | var attrs = [UICollectionViewLayoutAttributes]() 272 | 273 | for i in 0.. Bool { 296 | let oldBounds = collectionView?.bounds 297 | if newBounds.width != oldBounds?.width { 298 | return true 299 | } 300 | 301 | return false 302 | } 303 | } 304 | 305 | 306 | // MARK: - Private Methods 307 | private extension CollectionViewWaterfallLayout { 308 | func shortestColumnIndex() -> Int { 309 | var index: Int = 0 310 | var shortestHeight = MAXFLOAT 311 | 312 | for (idx, height) in columnHeights.enumerated() { 313 | if height < shortestHeight { 314 | shortestHeight = height 315 | index = idx 316 | } 317 | } 318 | 319 | return index 320 | } 321 | 322 | func longestColumnIndex() -> Int { 323 | var index: Int = 0 324 | var longestHeight:Float = 0 325 | 326 | for (idx, height) in columnHeights.enumerated() { 327 | if height > longestHeight { 328 | longestHeight = height 329 | index = idx 330 | } 331 | } 332 | 333 | return index 334 | } 335 | 336 | func invalidateIfNotEqual(_ oldValue: T, newValue: T) { 337 | if oldValue != newValue { 338 | invalidateLayout() 339 | } 340 | } 341 | } 342 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 ecerney 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CollectionViewWaterfallLayout 2 | ======================== 3 | 4 | Pinterest inspired layout for UICollectionViews 5 | 6 | **Note: Updated for Swift 5.0. This was a big upgrade from Swift 2.0, so please submit an issue / fix if you run into anything. Thanks!** 7 | 8 | **CollectionViewWaterfallLayout** is a subclass of [UICollectionViewLayout](https://developer.apple.com/library/ios/documentation/uikit/reference/UICollectionViewLayout_class/Reference/Reference.html) written completely in Swift. This class is based off [CHTCollectionViewWaterfallLayout](https://github.com/chiahsien/CHTCollectionViewWaterfallLayout) which was written by [chiahsien](https://github.com/chiahsien) in Objective-C. This class tries to use as many new Swifty things to keep the code updated with current design patterns. 9 | 10 | The original layout was inspired by [Pinterest](http://www.pinterest.com/). 11 | 12 | Features 13 | ----------- 14 | * Easy to use - If you are used to working with UICollectionViewFlowLayout, this should feel natural 15 | * Highly Customizable 16 | * Outstanding Performance 17 | * Supports headers and footers 18 | 19 | Screen Shots 20 | ----------- 21 | ![Real World Example](/Screenshots/RealWorldExample.png?raw=true "Real World Example") 22 | ![Demo Example](/Screenshots/DemoExample.png?raw=true "Demo Example") 23 | 24 | Prerequisites 25 | ----------- 26 | * ARC 27 | * iOS 8+ 28 | * Xcode 10+ 29 | * Swift 5.0 30 | 31 | Installation 32 | ----------- 33 | CollectionViewWaterfallLayout is available through CocoaPods. To install it, simply add the following line to your Podfile: 34 | ``` 35 | pod "CollectionViewWaterfallLayout" 36 | ``` 37 | 38 | How to Use 39 | ----------- 40 | 41 | Make sure to import the pod in the files you plan to use it in: 42 | ``` 43 | import CollectionViewWaterfallLayout 44 | ``` 45 | 46 | Check out the demo project for an example using storyboards to set up the views, and that programmatically creates and customizes the waterfall layout. 47 | 48 | #### Customizable Properties 49 | Below are the public properties and their default values that you can change to customize the layout 50 | ``` swift 51 | var columnCount: Int = 2 52 | var minimumColumnSpacing: Float = 10.0 53 | var minimumInteritemSpacing: Float = 10.0 54 | var headerHeight: Float = 0.0 55 | var footerHeight: Float = 0.0 56 | var headerInset: UIEdgeInsets = .zero 57 | var footerInset: UIEdgeInsets = .zero 58 | var sectionInset: UIEdgeInsets = .zero 59 | ``` 60 | 61 | #### Required Protocol 62 | Your collection view's delegate must conforms to `CollectionViewWaterfallLayoutDelegate` protocol and implement the required method, all you need to do is return the original size of the item: 63 | 64 | ``` swift 65 | func collectionView(collectionView: UICollectionView, layout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize 66 | ``` 67 | 68 | #### Optional Protocol 69 | You can customize the layout properties dynamically by using the following optional protocol methods: 70 | 71 | ``` swift 72 | func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, heightForHeaderInSection section: Int) -> Float 73 | 74 | func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, heightForFooterInSection section: Int) -> Float 75 | 76 | func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, insetForSection section: Int) -> UIEdgeInsets 77 | 78 | func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, insetForHeaderInSection section: Int) -> UIEdgeInsets 79 | 80 | func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, insetForFooterInSection section: Int) -> UIEdgeInsets 81 | 82 | func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, minimumInteritemSpacingForSection section: Int) -> Float 83 | ``` 84 | 85 | Limitation 86 | ---------- 87 | * Only vertical scrolling is supported. 88 | * No decoration view. 89 | 90 | License 91 | ------- 92 | CollectionViewWaterfallLayout is available under the MIT license. See the LICENSE file for more info. 93 | -------------------------------------------------------------------------------- /Screenshots/DemoExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ecerney/CollectionViewWaterfallLayout/4056ef68903a871cc52c7ad92398fbe651f9aa25/Screenshots/DemoExample.png -------------------------------------------------------------------------------- /Screenshots/RealWorldExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ecerney/CollectionViewWaterfallLayout/4056ef68903a871cc52c7ad92398fbe651f9aa25/Screenshots/RealWorldExample.png -------------------------------------------------------------------------------- /WaterfallDemo/CollectionViewWaterfallLayoutDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 026447C1233ADD4300271918 /* LabelCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 026447C0233ADD4300271918 /* LabelCollectionViewCell.swift */; }; 11 | 026447C3233AE30900271918 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 026447C2233AE30900271918 /* LaunchScreen.storyboard */; }; 12 | 029C0A2B197E226600DA6FE9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029C0A2A197E226600DA6FE9 /* AppDelegate.swift */; }; 13 | 029C0A2D197E226600DA6FE9 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029C0A2C197E226600DA6FE9 /* ViewController.swift */; }; 14 | 029C0A30197E226600DA6FE9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 029C0A2E197E226600DA6FE9 /* Main.storyboard */; }; 15 | 029C0A32197E226600DA6FE9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 029C0A31197E226600DA6FE9 /* Images.xcassets */; }; 16 | 029C0A3E197E226600DA6FE9 /* WaterfallFlowLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029C0A3D197E226600DA6FE9 /* WaterfallFlowLayoutTests.swift */; }; 17 | 029C0A4C19802E5E00DA6FE9 /* CollectionViewWaterfallLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029C0A4B19802E5E00DA6FE9 /* CollectionViewWaterfallLayout.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 029C0A38197E226600DA6FE9 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 029C0A1D197E226600DA6FE9 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 029C0A24197E226600DA6FE9; 26 | remoteInfo = WaterfallFlowLayout; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 026447C0233ADD4300271918 /* LabelCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelCollectionViewCell.swift; sourceTree = ""; }; 32 | 026447C2233AE30900271918 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 33 | 029C0A25197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CollectionViewWaterfallLayoutDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 029C0A29197E226600DA6FE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 029C0A2A197E226600DA6FE9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 36 | 029C0A2C197E226600DA6FE9 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 37 | 029C0A2F197E226600DA6FE9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38 | 029C0A31197E226600DA6FE9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 39 | 029C0A37197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CollectionViewWaterfallLayoutDemo.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 029C0A3C197E226600DA6FE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | 029C0A3D197E226600DA6FE9 /* WaterfallFlowLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaterfallFlowLayoutTests.swift; sourceTree = ""; }; 42 | 029C0A4B19802E5E00DA6FE9 /* CollectionViewWaterfallLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CollectionViewWaterfallLayout.swift; path = ../../CollectionViewWaterfallLayout.swift; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 029C0A22197E226600DA6FE9 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | 029C0A34197E226600DA6FE9 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 029C0A1C197E226600DA6FE9 = { 64 | isa = PBXGroup; 65 | children = ( 66 | 029C0A27197E226600DA6FE9 /* WaterfallFlowLayout */, 67 | 029C0A3A197E226600DA6FE9 /* WaterfallFlowLayoutTests */, 68 | 029C0A26197E226600DA6FE9 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | 029C0A26197E226600DA6FE9 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 029C0A25197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo.app */, 76 | 029C0A37197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 029C0A27197E226600DA6FE9 /* WaterfallFlowLayout */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 029C0A2A197E226600DA6FE9 /* AppDelegate.swift */, 85 | 029C0A2C197E226600DA6FE9 /* ViewController.swift */, 86 | 026447C0233ADD4300271918 /* LabelCollectionViewCell.swift */, 87 | 029C0A2E197E226600DA6FE9 /* Main.storyboard */, 88 | 026447C2233AE30900271918 /* LaunchScreen.storyboard */, 89 | 029C0A4B19802E5E00DA6FE9 /* CollectionViewWaterfallLayout.swift */, 90 | 029C0A31197E226600DA6FE9 /* Images.xcassets */, 91 | 029C0A28197E226600DA6FE9 /* Supporting Files */, 92 | ); 93 | path = WaterfallFlowLayout; 94 | sourceTree = ""; 95 | }; 96 | 029C0A28197E226600DA6FE9 /* Supporting Files */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 029C0A29197E226600DA6FE9 /* Info.plist */, 100 | ); 101 | name = "Supporting Files"; 102 | sourceTree = ""; 103 | }; 104 | 029C0A3A197E226600DA6FE9 /* WaterfallFlowLayoutTests */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 029C0A3D197E226600DA6FE9 /* WaterfallFlowLayoutTests.swift */, 108 | 029C0A3B197E226600DA6FE9 /* Supporting Files */, 109 | ); 110 | path = WaterfallFlowLayoutTests; 111 | sourceTree = ""; 112 | }; 113 | 029C0A3B197E226600DA6FE9 /* Supporting Files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 029C0A3C197E226600DA6FE9 /* Info.plist */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 029C0A24197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 029C0A41197E226600DA6FE9 /* Build configuration list for PBXNativeTarget "CollectionViewWaterfallLayoutDemo" */; 127 | buildPhases = ( 128 | 029C0A21197E226600DA6FE9 /* Sources */, 129 | 029C0A22197E226600DA6FE9 /* Frameworks */, 130 | 029C0A23197E226600DA6FE9 /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | ); 136 | name = CollectionViewWaterfallLayoutDemo; 137 | productName = WaterfallFlowLayout; 138 | productReference = 029C0A25197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo.app */; 139 | productType = "com.apple.product-type.application"; 140 | }; 141 | 029C0A36197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemoTests */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 029C0A44197E226600DA6FE9 /* Build configuration list for PBXNativeTarget "CollectionViewWaterfallLayoutDemoTests" */; 144 | buildPhases = ( 145 | 029C0A33197E226600DA6FE9 /* Sources */, 146 | 029C0A34197E226600DA6FE9 /* Frameworks */, 147 | 029C0A35197E226600DA6FE9 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | 029C0A39197E226600DA6FE9 /* PBXTargetDependency */, 153 | ); 154 | name = CollectionViewWaterfallLayoutDemoTests; 155 | productName = WaterfallFlowLayoutTests; 156 | productReference = 029C0A37197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo.xctest */; 157 | productType = "com.apple.product-type.bundle.unit-test"; 158 | }; 159 | /* End PBXNativeTarget section */ 160 | 161 | /* Begin PBXProject section */ 162 | 029C0A1D197E226600DA6FE9 /* Project object */ = { 163 | isa = PBXProject; 164 | attributes = { 165 | LastSwiftUpdateCheck = 0700; 166 | LastUpgradeCheck = 1030; 167 | ORGANIZATIONNAME = "Eric Cerney"; 168 | TargetAttributes = { 169 | 029C0A24197E226600DA6FE9 = { 170 | CreatedOnToolsVersion = 6.0; 171 | }; 172 | 029C0A36197E226600DA6FE9 = { 173 | CreatedOnToolsVersion = 6.0; 174 | TestTargetID = 029C0A24197E226600DA6FE9; 175 | }; 176 | }; 177 | }; 178 | buildConfigurationList = 029C0A20197E226600DA6FE9 /* Build configuration list for PBXProject "CollectionViewWaterfallLayoutDemo" */; 179 | compatibilityVersion = "Xcode 3.2"; 180 | developmentRegion = en; 181 | hasScannedForEncodings = 0; 182 | knownRegions = ( 183 | en, 184 | Base, 185 | ); 186 | mainGroup = 029C0A1C197E226600DA6FE9; 187 | productRefGroup = 029C0A26197E226600DA6FE9 /* Products */; 188 | projectDirPath = ""; 189 | projectRoot = ""; 190 | targets = ( 191 | 029C0A24197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo */, 192 | 029C0A36197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemoTests */, 193 | ); 194 | }; 195 | /* End PBXProject section */ 196 | 197 | /* Begin PBXResourcesBuildPhase section */ 198 | 029C0A23197E226600DA6FE9 /* Resources */ = { 199 | isa = PBXResourcesBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | 026447C3233AE30900271918 /* LaunchScreen.storyboard in Resources */, 203 | 029C0A30197E226600DA6FE9 /* Main.storyboard in Resources */, 204 | 029C0A32197E226600DA6FE9 /* Images.xcassets in Resources */, 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | }; 208 | 029C0A35197E226600DA6FE9 /* Resources */ = { 209 | isa = PBXResourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | }; 215 | /* End PBXResourcesBuildPhase section */ 216 | 217 | /* Begin PBXSourcesBuildPhase section */ 218 | 029C0A21197E226600DA6FE9 /* Sources */ = { 219 | isa = PBXSourcesBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | 029C0A2D197E226600DA6FE9 /* ViewController.swift in Sources */, 223 | 029C0A2B197E226600DA6FE9 /* AppDelegate.swift in Sources */, 224 | 029C0A4C19802E5E00DA6FE9 /* CollectionViewWaterfallLayout.swift in Sources */, 225 | 026447C1233ADD4300271918 /* LabelCollectionViewCell.swift in Sources */, 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | 029C0A33197E226600DA6FE9 /* Sources */ = { 230 | isa = PBXSourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | 029C0A3E197E226600DA6FE9 /* WaterfallFlowLayoutTests.swift in Sources */, 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | }; 237 | /* End PBXSourcesBuildPhase section */ 238 | 239 | /* Begin PBXTargetDependency section */ 240 | 029C0A39197E226600DA6FE9 /* PBXTargetDependency */ = { 241 | isa = PBXTargetDependency; 242 | target = 029C0A24197E226600DA6FE9 /* CollectionViewWaterfallLayoutDemo */; 243 | targetProxy = 029C0A38197E226600DA6FE9 /* PBXContainerItemProxy */; 244 | }; 245 | /* End PBXTargetDependency section */ 246 | 247 | /* Begin PBXVariantGroup section */ 248 | 029C0A2E197E226600DA6FE9 /* Main.storyboard */ = { 249 | isa = PBXVariantGroup; 250 | children = ( 251 | 029C0A2F197E226600DA6FE9 /* Base */, 252 | ); 253 | name = Main.storyboard; 254 | sourceTree = ""; 255 | }; 256 | /* End PBXVariantGroup section */ 257 | 258 | /* Begin XCBuildConfiguration section */ 259 | 029C0A3F197E226600DA6FE9 /* Debug */ = { 260 | isa = XCBuildConfiguration; 261 | buildSettings = { 262 | ALWAYS_SEARCH_USER_PATHS = NO; 263 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 264 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 265 | CLANG_CXX_LIBRARY = "libc++"; 266 | CLANG_ENABLE_MODULES = YES; 267 | CLANG_ENABLE_OBJC_ARC = YES; 268 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 269 | CLANG_WARN_BOOL_CONVERSION = YES; 270 | CLANG_WARN_COMMA = YES; 271 | CLANG_WARN_CONSTANT_CONVERSION = YES; 272 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 273 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 274 | CLANG_WARN_EMPTY_BODY = YES; 275 | CLANG_WARN_ENUM_CONVERSION = YES; 276 | CLANG_WARN_INFINITE_RECURSION = YES; 277 | CLANG_WARN_INT_CONVERSION = YES; 278 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 283 | CLANG_WARN_STRICT_PROTOTYPES = YES; 284 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = NO; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | ENABLE_TESTABILITY = YES; 291 | GCC_C_LANGUAGE_STANDARD = gnu99; 292 | GCC_DYNAMIC_NO_PIC = NO; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_OPTIMIZATION_LEVEL = 0; 295 | GCC_PREPROCESSOR_DEFINITIONS = ( 296 | "DEBUG=1", 297 | "$(inherited)", 298 | ); 299 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 300 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 301 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 302 | GCC_WARN_UNDECLARED_SELECTOR = YES; 303 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 304 | GCC_WARN_UNUSED_FUNCTION = YES; 305 | GCC_WARN_UNUSED_VARIABLE = YES; 306 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 307 | MTL_ENABLE_DEBUG_INFO = YES; 308 | ONLY_ACTIVE_ARCH = YES; 309 | SDKROOT = iphoneos; 310 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 311 | SWIFT_VERSION = 5.0; 312 | }; 313 | name = Debug; 314 | }; 315 | 029C0A40197E226600DA6FE9 /* Release */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ALWAYS_SEARCH_USER_PATHS = NO; 319 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 320 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 321 | CLANG_CXX_LIBRARY = "libc++"; 322 | CLANG_ENABLE_MODULES = YES; 323 | CLANG_ENABLE_OBJC_ARC = YES; 324 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 325 | CLANG_WARN_BOOL_CONVERSION = YES; 326 | CLANG_WARN_COMMA = YES; 327 | CLANG_WARN_CONSTANT_CONVERSION = YES; 328 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 329 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 330 | CLANG_WARN_EMPTY_BODY = YES; 331 | CLANG_WARN_ENUM_CONVERSION = YES; 332 | CLANG_WARN_INFINITE_RECURSION = YES; 333 | CLANG_WARN_INT_CONVERSION = YES; 334 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 336 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 337 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 338 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 339 | CLANG_WARN_STRICT_PROTOTYPES = YES; 340 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 341 | CLANG_WARN_UNREACHABLE_CODE = YES; 342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 343 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 344 | COPY_PHASE_STRIP = YES; 345 | ENABLE_NS_ASSERTIONS = NO; 346 | ENABLE_STRICT_OBJC_MSGSEND = YES; 347 | GCC_C_LANGUAGE_STANDARD = gnu99; 348 | GCC_NO_COMMON_BLOCKS = YES; 349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 351 | GCC_WARN_UNDECLARED_SELECTOR = YES; 352 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 353 | GCC_WARN_UNUSED_FUNCTION = YES; 354 | GCC_WARN_UNUSED_VARIABLE = YES; 355 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 356 | MTL_ENABLE_DEBUG_INFO = NO; 357 | SDKROOT = iphoneos; 358 | SWIFT_COMPILATION_MODE = wholemodule; 359 | SWIFT_VERSION = 5.0; 360 | VALIDATE_PRODUCT = YES; 361 | }; 362 | name = Release; 363 | }; 364 | 029C0A42197E226600DA6FE9 /* Debug */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 368 | DEVELOPMENT_TEAM = ""; 369 | INFOPLIST_FILE = WaterfallFlowLayout/Info.plist; 370 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 371 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 372 | PRODUCT_BUNDLE_IDENTIFIER = "com.ecerney.${PRODUCT_NAME:rfc1034identifier}"; 373 | PRODUCT_NAME = CollectionViewWaterfallLayoutDemo; 374 | SWIFT_VERSION = 5.0; 375 | }; 376 | name = Debug; 377 | }; 378 | 029C0A43197E226600DA6FE9 /* Release */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 382 | DEVELOPMENT_TEAM = ""; 383 | INFOPLIST_FILE = WaterfallFlowLayout/Info.plist; 384 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 386 | PRODUCT_BUNDLE_IDENTIFIER = "com.ecerney.${PRODUCT_NAME:rfc1034identifier}"; 387 | PRODUCT_NAME = CollectionViewWaterfallLayoutDemo; 388 | SWIFT_VERSION = 5.0; 389 | }; 390 | name = Release; 391 | }; 392 | 029C0A45197E226600DA6FE9 /* Debug */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | BUNDLE_LOADER = "$(TEST_HOST)"; 396 | FRAMEWORK_SEARCH_PATHS = ( 397 | "$(SDKROOT)/Developer/Library/Frameworks", 398 | "$(inherited)", 399 | ); 400 | GCC_PREPROCESSOR_DEFINITIONS = ( 401 | "DEBUG=1", 402 | "$(inherited)", 403 | ); 404 | INFOPLIST_FILE = WaterfallFlowLayoutTests/Info.plist; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 406 | PRODUCT_BUNDLE_IDENTIFIER = "com.ecerney.${PRODUCT_NAME:rfc1034identifier}"; 407 | PRODUCT_NAME = CollectionViewWaterfallLayoutDemo; 408 | SWIFT_VERSION = 5.0; 409 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CollectionViewWaterfallLayoutDemo.app/CollectionViewWaterfallLayoutDemo"; 410 | }; 411 | name = Debug; 412 | }; 413 | 029C0A46197E226600DA6FE9 /* Release */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | BUNDLE_LOADER = "$(TEST_HOST)"; 417 | FRAMEWORK_SEARCH_PATHS = ( 418 | "$(SDKROOT)/Developer/Library/Frameworks", 419 | "$(inherited)", 420 | ); 421 | INFOPLIST_FILE = WaterfallFlowLayoutTests/Info.plist; 422 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 423 | PRODUCT_BUNDLE_IDENTIFIER = "com.ecerney.${PRODUCT_NAME:rfc1034identifier}"; 424 | PRODUCT_NAME = CollectionViewWaterfallLayoutDemo; 425 | SWIFT_VERSION = 5.0; 426 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CollectionViewWaterfallLayoutDemo.app/CollectionViewWaterfallLayoutDemo"; 427 | }; 428 | name = Release; 429 | }; 430 | /* End XCBuildConfiguration section */ 431 | 432 | /* Begin XCConfigurationList section */ 433 | 029C0A20197E226600DA6FE9 /* Build configuration list for PBXProject "CollectionViewWaterfallLayoutDemo" */ = { 434 | isa = XCConfigurationList; 435 | buildConfigurations = ( 436 | 029C0A3F197E226600DA6FE9 /* Debug */, 437 | 029C0A40197E226600DA6FE9 /* Release */, 438 | ); 439 | defaultConfigurationIsVisible = 0; 440 | defaultConfigurationName = Release; 441 | }; 442 | 029C0A41197E226600DA6FE9 /* Build configuration list for PBXNativeTarget "CollectionViewWaterfallLayoutDemo" */ = { 443 | isa = XCConfigurationList; 444 | buildConfigurations = ( 445 | 029C0A42197E226600DA6FE9 /* Debug */, 446 | 029C0A43197E226600DA6FE9 /* Release */, 447 | ); 448 | defaultConfigurationIsVisible = 0; 449 | defaultConfigurationName = Release; 450 | }; 451 | 029C0A44197E226600DA6FE9 /* Build configuration list for PBXNativeTarget "CollectionViewWaterfallLayoutDemoTests" */ = { 452 | isa = XCConfigurationList; 453 | buildConfigurations = ( 454 | 029C0A45197E226600DA6FE9 /* Debug */, 455 | 029C0A46197E226600DA6FE9 /* Release */, 456 | ); 457 | defaultConfigurationIsVisible = 0; 458 | defaultConfigurationName = Release; 459 | }; 460 | /* End XCConfigurationList section */ 461 | }; 462 | rootObject = 029C0A1D197E226600DA6FE9 /* Project object */; 463 | } 464 | -------------------------------------------------------------------------------- /WaterfallDemo/CollectionViewWaterfallLayoutDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WaterfallDemo/CollectionViewWaterfallLayoutDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // WaterfallFlowLayout 4 | // 5 | // Created by Eric Cerney on 7/21/14. 6 | // Copyright (c) 2014 Eric Cerney. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { 17 | return true 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/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 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/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 | } -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "extent" : "full-screen", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "filename" : "Default-568h@2x.png", 15 | "minimum-system-version" : "7.0", 16 | "orientation" : "portrait", 17 | "scale" : "2x" 18 | } 19 | ], 20 | "info" : { 21 | "version" : 1, 22 | "author" : "xcode" 23 | } 24 | } -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ecerney/CollectionViewWaterfallLayout/4056ef68903a871cc52c7ad92398fbe651f9aa25/WaterfallDemo/WaterfallFlowLayout/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/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 | Waterfall Demo 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 | -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/LabelCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LabelCollectionViewCell.swift 3 | // CollectionViewWaterfallLayoutDemo 4 | // 5 | // Created by Eric Cerney on 9/24/19. 6 | // Copyright © 2019 Eric Cerney. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class LabelCollectionViewCell: UICollectionViewCell { 12 | @IBOutlet var label: UILabel! 13 | } 14 | -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/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 | 30 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayout/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // WaterfallFlowLayout 4 | // 5 | // Created by Eric Cerney on 7/21/14. 6 | // Copyright (c) 2014 Eric Cerney. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet var collectionView: UICollectionView! 14 | 15 | lazy var cellSizes: [CGSize] = { 16 | var cellSizes = [CGSize]() 17 | 18 | for _ in 0...100 { 19 | let random = Int(arc4random_uniform((UInt32(100)))) 20 | 21 | cellSizes.append(CGSize(width: 140, height: 50 + random)) 22 | } 23 | 24 | return cellSizes 25 | }() 26 | 27 | override func viewDidLoad() { 28 | super.viewDidLoad() 29 | 30 | let layout = CollectionViewWaterfallLayout() 31 | layout.sectionInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) 32 | layout.headerInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0) 33 | layout.headerHeight = 50 34 | layout.footerHeight = 20 35 | layout.minimumColumnSpacing = 10 36 | layout.minimumInteritemSpacing = 10 37 | 38 | collectionView.collectionViewLayout = layout 39 | collectionView.register(UICollectionReusableView.self, forSupplementaryViewOfKind: CollectionViewWaterfallElementKindSectionHeader, withReuseIdentifier: "Header") 40 | collectionView.register(UICollectionReusableView.self, forSupplementaryViewOfKind: CollectionViewWaterfallElementKindSectionFooter, withReuseIdentifier: "Footer") 41 | } 42 | } 43 | 44 | // MARK: - UICollectionViewDataSource 45 | extension ViewController: UICollectionViewDataSource { 46 | func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { 47 | return 1 48 | } 49 | 50 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 51 | return cellSizes.count 52 | } 53 | 54 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 55 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! LabelCollectionViewCell 56 | 57 | cell.label.text = String(indexPath.row) 58 | 59 | return cell 60 | } 61 | 62 | func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { 63 | let reusableView: UICollectionReusableView? 64 | 65 | switch kind { 66 | case CollectionViewWaterfallElementKindSectionHeader: 67 | let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "Header", for: indexPath) 68 | header.backgroundColor = .red 69 | reusableView = header 70 | case CollectionViewWaterfallElementKindSectionFooter: 71 | let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "Footer", for: indexPath) 72 | footer.backgroundColor = .blue 73 | reusableView = footer 74 | default: 75 | reusableView = nil 76 | } 77 | 78 | return reusableView! 79 | } 80 | } 81 | 82 | 83 | // MARK: - CollectionViewWaterfallLayoutDelegate 84 | extension ViewController: CollectionViewWaterfallLayoutDelegate { 85 | func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { 86 | return cellSizes[indexPath.item] 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayoutTests/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 | -------------------------------------------------------------------------------- /WaterfallDemo/WaterfallFlowLayoutTests/WaterfallFlowLayoutTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WaterfallFlowLayoutTests.swift 3 | // WaterfallFlowLayoutTests 4 | // 5 | // Created by Eric Cerney on 7/21/14. 6 | // Copyright (c) 2014 Eric Cerney. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class WaterfallFlowLayoutTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------