├── WaterfallTrueCompositionalLayoutDemo ├── WaterfallTrueCompositionalLayoutDemo │ ├── Resources │ │ ├── Assets.xcassets │ │ │ ├── Contents.json │ │ │ ├── AccentColor.colorset │ │ │ │ └── Contents.json │ │ │ ├── water_image.imageset │ │ │ │ ├── water_image.jpg │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── Base.lproj │ │ │ └── LaunchScreen.storyboard │ ├── Screen │ │ ├── ItemModel.swift │ │ ├── CollectionViewCell.swift │ │ ├── ViewController.swift │ │ └── ViewModel.swift │ └── Supporting files │ │ ├── AppDelegate.swift │ │ ├── SceneDelegate.swift │ │ └── UIMenu+Picker.swift └── WaterfallTrueCompositionalLayoutDemo.xcodeproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── Package.swift ├── LICENSE ├── Sources └── WaterfallTrueCompositionalLayout │ ├── WaterfallTrueCompositionalLayout.swift │ ├── WaterfallTrueCompositionalLayout+Config.swift │ └── WaterfallTrueCompositionalLayout+LayoutBuilder.swift ├── README.md └── .gitignore /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Resources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Resources/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Resources/Assets.xcassets/water_image.imageset/water_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eeshishko/WaterfallTrueCompositionalLayout/HEAD/WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Resources/Assets.xcassets/water_image.imageset/water_image.jpg -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Resources/Assets.xcassets/water_image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "water_image.jpg", 5 | "idiom" : "universal" 6 | } 7 | ], 8 | "info" : { 9 | "author" : "xcode", 10 | "version" : 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "WaterfallTrueCompositionalLayout", 8 | platforms: [ 9 | .iOS(.v14) 10 | ], 11 | products: [ 12 | .library( 13 | name: "WaterfallTrueCompositionalLayout", 14 | targets: ["WaterfallTrueCompositionalLayout"]), 15 | ], 16 | dependencies: [ 17 | ], 18 | targets: [ 19 | .target( 20 | name: "WaterfallTrueCompositionalLayout", 21 | dependencies: []) 22 | ] 23 | ) 24 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIApplicationSceneManifest 6 | 7 | UIApplicationSupportsMultipleScenes 8 | 9 | UISceneConfigurations 10 | 11 | UIWindowSceneSessionRoleApplication 12 | 13 | 14 | UISceneConfigurationName 15 | Default Configuration 16 | UISceneDelegateClassName 17 | $(PRODUCT_MODULE_NAME).SceneDelegate 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Screen/ItemModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemModel.swift 3 | // WaterfallTrueCompositionalLayoutDemo 4 | // 5 | // Created by Evgeny Shishko on 19.09.2022. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | struct ItemModel: Hashable { 12 | let title: String 13 | let color = randomColor() 14 | let height = CGFloat.random(in: 30...100) 15 | 16 | private static func randomColor() -> UIColor { 17 | let hue = CGFloat(arc4random() % 256) / 256 18 | let saturation = CGFloat(arc4random() % 128) / 256 + 0.5 19 | let brightness = CGFloat(arc4random() % 128) / 256 + 0.5 20 | return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1) 21 | } 22 | 23 | func hash(into hasher: inout Hasher) { 24 | hasher.combine(title) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Supporting files/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // WaterfallTrueCompositionalLayoutDemo 4 | // 5 | // Created by Evgeny Shishko on 12.09.2022. 6 | // 7 | 8 | import UIKit 9 | 10 | @main 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 14 | return true 15 | } 16 | 17 | // MARK: UISceneSession Lifecycle 18 | 19 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 20 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Supporting files/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // WaterfallTrueCompositionalLayoutDemo 4 | // 5 | // Created by Evgeny Shishko on 12.09.2022. 6 | // 7 | 8 | import UIKit 9 | 10 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 11 | var window: UIWindow? 12 | 13 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 14 | guard let scene = (scene as? UIWindowScene) else { return } 15 | let viewController = ViewController() 16 | 17 | let window = UIWindow(windowScene: scene) 18 | let navigationViewController = UINavigationController(rootViewController: viewController) 19 | window.rootViewController = navigationViewController 20 | self.window = window 21 | window.makeKeyAndVisible() 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Evgenii Shishko  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 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Supporting files/UIMenu+Picker.swift: -------------------------------------------------------------------------------- 1 | /** 2 | * UIKitHelpers 3 | * Copyright (c) Luca Meghnagi 2021 4 | * MIT license, see LICENSE file for details 5 | */ 6 | 7 | import Combine 8 | import UIKit 9 | 10 | @available(iOS 13.0, *) 11 | public extension UIMenu { 12 | 13 | static func picker( 14 | title: String, 15 | symbolName: String, 16 | items: [Item], 17 | itemTitle: (Item) -> String, 18 | itemSubject: CurrentValueSubject 19 | ) -> UIMenu { 20 | picker( 21 | title: title, 22 | symbolName: symbolName, 23 | items: items, 24 | itemTitle: itemTitle, 25 | isItemSelected: { itemSubject.value == $0 }, 26 | didSelectItem: itemSubject.send 27 | ) 28 | } 29 | 30 | static func picker( 31 | title: String, 32 | symbolName: String, 33 | items: [Item], 34 | itemTitle: (Item) -> String, 35 | isItemSelected: (Item) -> Bool, 36 | didSelectItem: @escaping (Item) -> Void 37 | ) -> UIMenu { 38 | UIMenu( 39 | title: title, 40 | image: UIImage(systemName: symbolName), 41 | children: items.map { item in 42 | UIAction( 43 | title: itemTitle(item), 44 | state: isItemSelected(item) ? .on : .off, 45 | handler: { _ in 46 | didSelectItem(item) 47 | } 48 | ) 49 | } 50 | ) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Sources/WaterfallTrueCompositionalLayout/WaterfallTrueCompositionalLayout.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | /// Pinterest/waterfall like layout allows to have shifted items of different heights independently 4 | public final class WaterfallTrueCompositionalLayout { 5 | /// Creates `NSCollectionLayoutSection` instance for `WaterfallTrueCompositionalLayout` 6 | /// - Parameters: 7 | /// - config: Parameters describing your desired layout 8 | /// - environment: environment which is accessible on provider closure for UICollectionView 9 | /// - sectionIndex: index of a section in certain UICollectionView 10 | /// - Returns: Pinterest-like layout 11 | public static func makeLayoutSection( 12 | config: Configuration, 13 | environment: NSCollectionLayoutEnvironment, 14 | sectionIndex: Int 15 | ) -> NSCollectionLayoutSection { 16 | var items = [NSCollectionLayoutGroupCustomItem]() 17 | let itemProvider = LayoutBuilder( 18 | configuration: config, 19 | collectionWidth: environment.container.contentSize.width 20 | ) 21 | for i in 0.. 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 | -------------------------------------------------------------------------------- /Sources/WaterfallTrueCompositionalLayout/WaterfallTrueCompositionalLayout+Config.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WaterfallTrueCompositionalLayout+Config.swift 3 | // 4 | // 5 | // Created by Evgeny Shishko on 12.09.2022. 6 | // 7 | 8 | import UIKit 9 | 10 | public extension WaterfallTrueCompositionalLayout { 11 | typealias ItemHeightProvider = (_ index: Int, _ itemWidth: CGFloat) -> CGFloat 12 | typealias ItemCountProvider = () -> Int 13 | 14 | struct Configuration { 15 | public let columnCount: Int 16 | public let interItemSpacing: CGFloat 17 | public let contentInsetsReference: UIContentInsetsReference 18 | public let itemHeightProvider: ItemHeightProvider 19 | public let itemCountProvider: ItemCountProvider 20 | 21 | /// Initialization for configuration of waterfall compositional layout section 22 | /// - Parameters: 23 | /// - columnCount: a number of columns 24 | /// - interItemSpacing: a spacing between columns and rows 25 | /// - contentInsetsReference: a reference point for content insets for a section 26 | /// - itemCountProvider: closure providing a number of items in a section 27 | /// - itemHeightProvider: closure for providing an item height at a specific index 28 | public init( 29 | columnCount: Int = 2, 30 | interItemSpacing: CGFloat = 8, 31 | contentInsetsReference: UIContentInsetsReference = .automatic, 32 | itemCountProvider: @escaping ItemCountProvider, 33 | itemHeightProvider: @escaping ItemHeightProvider 34 | ) { 35 | self.columnCount = columnCount 36 | self.interItemSpacing = interItemSpacing 37 | self.contentInsetsReference = contentInsetsReference 38 | self.itemCountProvider = itemCountProvider 39 | self.itemHeightProvider = itemHeightProvider 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WaterfallTrueCompositionalLayout 🖼️ 2 | 3 | This library allows you to create pinterest-like layout using collection view compositional layout. Compare to other solutions I've found on Internet, they provide general UICollectionViewLayout which doesn't allow you to use full advantage of compositional layout having various section appearances. 4 | 5 | ![](https://user-images.githubusercontent.com/14946233/203838156-1f3c7e0d-cd9a-40ec-b652-8b89206a26bb.gif) 6 | 7 | ## Add a dependency using SPM 8 | 9 | WaterfallTrueCompositionalLayout is accessible through [Swift Package Manager](https://swift.org/package-manager). 10 | 11 | To use it inside your project, add it through XCode project Settings or as a dependency within your Package.swift manifest: 12 | ```swift 13 | let package = Package( 14 | dependencies: [ 15 | .package(url: "https://github.com/eeshishko/WaterfallTrueCompositionalLayout.git", from: "1.0.0") 16 | ], 17 | ) 18 | ``` 19 | 20 | ## API 21 | 22 | First, create ```WaterfallTrueCompositionalLayout.Configuration``` instance describing your layout: 23 | ```swift 24 | let configuration = WaterfallTrueCompositionalLayout.Configuration( 25 | columnCount: 2, 26 | interItemSpacing: 8, 27 | contentInsetsReference: .automatic, 28 | itemCountProvider: { [weak self] in 29 | return 10 30 | }, 31 | itemHeightProvider: { [weak self] row, width in 32 | return width * 1.2 33 | } 34 | ) 35 | ``` 36 | 37 | Then pass it along with enviroment and section index, which are available through ```UICollectionViewCompositionalLayout``` initializater: 38 | 39 | ```swift 40 | let layout = UICollectionViewCompositionalLayout { sectionIndex, enviroment in 41 | WaterfallTrueCompositionalLayout.makeLayoutSection( 42 | config: configuration, 43 | enviroment: enviroment, 44 | sectionIndex: sectionIndex 45 | ) 46 | } 47 | ``` 48 | 49 | For exploring possibilities of the lib and how to use it properly, you can have a look at the [demo project](https://github.com/eeshishko/WaterfallTrueCompositionalLayout/tree/main/WaterfallTrueCompositionalLayoutDemo) in the repository. 50 | 51 | # Contributing 52 | Feel free to raise any issues, improvements or pull requests 😊 53 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Screen/CollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCell.swift 3 | // WaterfallTrueCompositionalLayoutDemo 4 | // 5 | // Created by Evgeny Shishko on 19.09.2022. 6 | // 7 | 8 | import UIKit 9 | 10 | class CollectionViewCell: UICollectionViewCell { 11 | private let textLabel: UILabel = { 12 | let label = UILabel() 13 | label.translatesAutoresizingMaskIntoConstraints = false 14 | label.textColor = .black 15 | label.font = .preferredFont(forTextStyle: .caption2) 16 | label.textAlignment = .center 17 | label.setContentCompressionResistancePriority(.defaultHigh + 2, for: .vertical) 18 | return label 19 | }() 20 | 21 | private let imageView: UIImageView = { 22 | let view = UIImageView() 23 | view.translatesAutoresizingMaskIntoConstraints = false 24 | view.contentMode = .scaleAspectFill 25 | view.image = UIImage(named: "water_image") 26 | view.clipsToBounds = true 27 | return view 28 | }() 29 | 30 | override init(frame: CGRect) { 31 | super.init(frame: frame) 32 | setUp() 33 | } 34 | 35 | required init?(coder: NSCoder) { 36 | fatalError("init(coder:) has not been implemented") 37 | } 38 | 39 | func configure(with item: ItemModel) { 40 | textLabel.text = item.title 41 | contentView.backgroundColor = item.color 42 | } 43 | 44 | private func setUp() { 45 | contentView.addSubview(textLabel) 46 | contentView.addSubview(imageView) 47 | 48 | NSLayoutConstraint.activate([ 49 | imageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), 50 | imageView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor), 51 | imageView.topAnchor.constraint(equalTo: contentView.topAnchor), 52 | imageView.bottomAnchor.constraint(equalTo: textLabel.topAnchor, constant: -8), 53 | { 54 | let constraint = imageView.heightAnchor.constraint(equalTo: imageView.widthAnchor, multiplier: 0.5) 55 | constraint.priority = .defaultHigh + 1 56 | return constraint 57 | }(), 58 | 59 | textLabel.centerXAnchor.constraint(equalTo: contentView.centerXAnchor), 60 | textLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -8) 61 | ]) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /Sources/WaterfallTrueCompositionalLayout/WaterfallTrueCompositionalLayout+LayoutBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WaterfallTrueCompositionalLayout+LayoutBuilder.swift 3 | // 4 | // 5 | // Created by Evgeny Shishko on 12.09.2022. 6 | // 7 | 8 | import UIKit 9 | 10 | extension WaterfallTrueCompositionalLayout { 11 | final class LayoutBuilder { 12 | private var columnHeights: [CGFloat] 13 | private let columnCount: CGFloat 14 | private let itemHeightProvider: ItemHeightProvider 15 | private let interItemSpacing: CGFloat 16 | private let collectionWidth: CGFloat 17 | 18 | init( 19 | configuration: Configuration, 20 | collectionWidth: CGFloat 21 | ) { 22 | self.columnHeights = [CGFloat](repeating: 0, count: configuration.columnCount) 23 | self.columnCount = CGFloat(configuration.columnCount) 24 | self.itemHeightProvider = configuration.itemHeightProvider 25 | self.interItemSpacing = configuration.interItemSpacing 26 | self.collectionWidth = collectionWidth 27 | } 28 | 29 | func makeLayoutItem(for row: Int) -> NSCollectionLayoutGroupCustomItem { 30 | let frame = frame(for: row) 31 | columnHeights[columnIndex()] = frame.maxY + interItemSpacing 32 | return NSCollectionLayoutGroupCustomItem(frame: frame) 33 | } 34 | 35 | func maxColumnHeight() -> CGFloat { 36 | return columnHeights.max() ?? 0 37 | } 38 | } 39 | } 40 | 41 | private extension WaterfallTrueCompositionalLayout.LayoutBuilder { 42 | private var columnWidth: CGFloat { 43 | let spacing = (columnCount - 1) * interItemSpacing 44 | return (collectionWidth - spacing) / columnCount 45 | } 46 | 47 | func frame(for row: Int) -> CGRect { 48 | let width = columnWidth 49 | let height = itemHeightProvider(row, width) 50 | let size = CGSize(width: width, height: height) 51 | let origin = itemOrigin(width: size.width) 52 | return CGRect(origin: origin, size: size) 53 | } 54 | 55 | private func itemOrigin(width: CGFloat) -> CGPoint { 56 | let y = columnHeights[columnIndex()].rounded() 57 | let x = (width + interItemSpacing) * CGFloat(columnIndex()) 58 | return CGPoint(x: x, y: y) 59 | } 60 | 61 | private func columnIndex() -> Int { 62 | columnHeights 63 | .enumerated() 64 | .min(by: { $0.element < $1.element })? 65 | .offset ?? 0 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Screen/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // WaterfallTrueCompositionalLayoutDemo 4 | // 5 | // Created by Evgeny Shishko on 12.09.2022. 6 | // 7 | 8 | import UIKit 9 | import Combine 10 | import WaterfallTrueCompositionalLayout 11 | 12 | final class ViewController: UICollectionViewController { 13 | private lazy var dataSource = makeDataSource() 14 | 15 | private let editButton = UIBarButtonItem( 16 | title: "Edit" 17 | ) 18 | 19 | private var cancellables = Set() 20 | 21 | private let viewModel = ViewModel() 22 | 23 | init() { 24 | super.init(collectionViewLayout: UICollectionViewFlowLayout()) 25 | } 26 | 27 | required init?(coder: NSCoder) { 28 | fatalError("init(coder:) has not been implemented") 29 | } 30 | 31 | override func viewDidLoad() { 32 | super.viewDidLoad() 33 | 34 | title = "Waterfall True Compositional" 35 | collectionView.backgroundColor = .systemBackground 36 | navigationItem.leftBarButtonItem = editButton 37 | 38 | viewModel.layoutConfiguration.sink { [unowned self] configuration in 39 | let layout = UICollectionViewCompositionalLayout { sectionIndex, enviroment in 40 | WaterfallTrueCompositionalLayout.makeLayoutSection( 41 | config: configuration, 42 | enviroment: enviroment, 43 | sectionIndex: sectionIndex 44 | ) 45 | } 46 | collectionView.setCollectionViewLayout(layout, animated: true) 47 | }.store(in: &cancellables) 48 | 49 | viewModel.snapshot.sink { [unowned self] snapshot in 50 | dataSource.apply(snapshot) 51 | }.store(in: &cancellables) 52 | 53 | viewModel.menu.sink { [unowned self] menu in 54 | editButton.menu = menu 55 | }.store(in: &cancellables) 56 | } 57 | 58 | override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 59 | viewModel.removeItem(at: indexPath) 60 | } 61 | 62 | private func makeDataSource() -> UICollectionViewDiffableDataSource { 63 | let registration = makeCellRegistration() 64 | return UICollectionViewDiffableDataSource(collectionView: collectionView) { collectionView, indexPath, item in 65 | collectionView.dequeueConfiguredReusableCell( 66 | using: registration, 67 | for: indexPath, 68 | item: item 69 | ) 70 | } 71 | } 72 | 73 | private func makeCellRegistration() -> UICollectionView.CellRegistration { 74 | UICollectionView.CellRegistration { cell, _, item in 75 | cell.configure(with: item) 76 | } 77 | } 78 | } 79 | 80 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo/Screen/ViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewModel.swift 3 | // WaterfallTrueCompositionalLayoutDemo 4 | // 5 | // Created by Evgeny Shishko on 19.09.2022. 6 | // 7 | 8 | import Combine 9 | import WaterfallTrueCompositionalLayout 10 | import UIKit 11 | 12 | final class ViewModel { 13 | lazy var layoutConfiguration = Publishers.CombineLatest3( 14 | columnCountSubject, 15 | spacingSubject, 16 | contentInsetsReferenceSubject 17 | ).map { [unowned self] _, _, _ in 18 | makeWaterfallLayoutConfiguration() 19 | }.eraseToAnyPublisher() 20 | 21 | lazy var menu = Publishers.CombineLatest3( 22 | columnCountSubject, 23 | spacingSubject, 24 | contentInsetsReferenceSubject 25 | ).map { [unowned self] _, _, _ in 26 | makeMenu() 27 | }.eraseToAnyPublisher() 28 | 29 | lazy var snapshot = itemsSubject.map { items -> NSDiffableDataSourceSnapshot in 30 | var snapshot = NSDiffableDataSourceSnapshot() 31 | snapshot.appendSections([0]) 32 | snapshot.appendItems(items, toSection: 0) 33 | return snapshot 34 | }.eraseToAnyPublisher() 35 | 36 | private let columnCountSubject = CurrentValueSubject(Constants.columnCount) 37 | private let spacingSubject = CurrentValueSubject(Constants.spacing) 38 | private let contentInsetsReferenceSubject = CurrentValueSubject(Constants.contentInsetsReference) 39 | private let itemsSubject = CurrentValueSubject<[ItemModel], Never>(makeItems()) 40 | 41 | init() {} 42 | 43 | func removeItem(at indexPath: IndexPath) { 44 | itemsSubject.value.remove(at: indexPath.row) 45 | } 46 | 47 | private func reset() { 48 | columnCountSubject.value = Constants.columnCount 49 | spacingSubject.value = Constants.spacing 50 | contentInsetsReferenceSubject.value = Constants.contentInsetsReference 51 | itemsSubject.value = ViewModel.makeItems() 52 | } 53 | 54 | private func makeWaterfallLayoutConfiguration() -> WaterfallTrueCompositionalLayout.Configuration { 55 | .init( 56 | columnCount: columnCountSubject.value, 57 | interItemSpacing: spacingSubject.value, 58 | contentInsetsReference: contentInsetsReferenceSubject.value, 59 | itemCountProvider: { [weak self] in 60 | self?.itemsSubject.value.count ?? 0 61 | }, 62 | itemHeightProvider: { [weak self] row, _ in 63 | self?.itemsSubject.value[row].height ?? 0 64 | } 65 | ) 66 | } 67 | 68 | private func makeMenu() -> UIMenu { 69 | UIMenu( 70 | title: "Edit Layout", 71 | children: [ 72 | UIMenu( 73 | options: .displayInline, 74 | children: [ 75 | makeColumnCountSelectionMenu(), 76 | makeSpacingSelectionMenu(), 77 | makeContentInsetsReferenceMenu() 78 | ] 79 | ), 80 | UIMenu( 81 | options: .displayInline, 82 | children: [ 83 | makeResetAction() 84 | ] 85 | ) 86 | ] 87 | ) 88 | } 89 | 90 | private func makeColumnCountSelectionMenu() -> UIMenu { 91 | UIMenu.picker( 92 | title: "Column Count", 93 | symbolName: "building.columns", 94 | items: [1, 2, 3, 4, 5, 6, 7, 8], 95 | itemTitle: String.init, 96 | itemSubject: columnCountSubject 97 | ) 98 | } 99 | 100 | private func makeSpacingSelectionMenu() -> UIMenu { 101 | UIMenu.picker( 102 | title: "Spacing", 103 | symbolName: "arrow.left.and.right", 104 | items: [0, 2, 8, 16], 105 | itemTitle: { String(format: "%.0f pt", $0) }, 106 | itemSubject: spacingSubject 107 | ) 108 | } 109 | 110 | private func makeContentInsetsReferenceMenu() -> UIMenu { 111 | UIMenu.picker( 112 | title: "Content Insets Reference", 113 | symbolName: "squareshape.dashed.squareshape", 114 | items: [.automatic, .none, .safeArea, .layoutMargins, .readableContent], 115 | itemTitle: { reference in 116 | switch reference { 117 | case .automatic: 118 | return "Automatic" 119 | case .none: 120 | return "None" 121 | case .safeArea: 122 | return "Safe Area" 123 | case .layoutMargins: 124 | return "Layout Margins" 125 | case .readableContent: 126 | return "Readable Content" 127 | @unknown default: 128 | fatalError() 129 | } 130 | }, 131 | itemSubject: contentInsetsReferenceSubject 132 | ) 133 | } 134 | 135 | private func makeResetAction() -> UIAction { 136 | UIAction( 137 | title: "Reset", 138 | image: UIImage(systemName: "arrow.counterclockwise"), 139 | handler: { [unowned self] _ in 140 | reset() 141 | } 142 | ) 143 | } 144 | } 145 | 146 | private extension ViewModel { 147 | enum Constants { 148 | static let columnCount = 3 149 | static let spacing: CGFloat = 8 150 | static let contentInsetsReference = UIContentInsetsReference.automatic 151 | } 152 | 153 | static func makeItems() -> [ItemModel] { 154 | (0...500).map { .init(title: "Item \($0)")} 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /WaterfallTrueCompositionalLayoutDemo/WaterfallTrueCompositionalLayoutDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 74A0E3DF28CFAD7C0074911F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74A0E3DE28CFAD7C0074911F /* AppDelegate.swift */; }; 11 | 74A0E3E128CFAD7C0074911F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74A0E3E028CFAD7C0074911F /* SceneDelegate.swift */; }; 12 | 74A0E3E328CFAD7C0074911F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74A0E3E228CFAD7C0074911F /* ViewController.swift */; }; 13 | 74A0E3E828CFAD7E0074911F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 74A0E3E728CFAD7E0074911F /* Assets.xcassets */; }; 14 | 74A0E3EB28CFAD7E0074911F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 74A0E3E928CFAD7E0074911F /* LaunchScreen.storyboard */; }; 15 | 74A0E3FC28CFAE920074911F /* WaterfallTrueCompositionalLayout in Frameworks */ = {isa = PBXBuildFile; productRef = 74A0E3FB28CFAE920074911F /* WaterfallTrueCompositionalLayout */; }; 16 | 74A0E40028D8A1480074911F /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74A0E3FF28D8A1480074911F /* ViewModel.swift */; }; 17 | 74A0E40228D8A1D60074911F /* ItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74A0E40128D8A1D60074911F /* ItemModel.swift */; }; 18 | 74A0E40428D8A28D0074911F /* CollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74A0E40328D8A28D0074911F /* CollectionViewCell.swift */; }; 19 | 74A0E40728D8A6BF0074911F /* UIMenu+Picker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74A0E40628D8A6BF0074911F /* UIMenu+Picker.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 74A0E3DB28CFAD7C0074911F /* WaterfallTrueCompositionalLayoutDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WaterfallTrueCompositionalLayoutDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 74A0E3DE28CFAD7C0074911F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | 74A0E3E028CFAD7C0074911F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 26 | 74A0E3E228CFAD7C0074911F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 27 | 74A0E3E728CFAD7E0074911F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 74A0E3EA28CFAD7E0074911F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 74A0E3EC28CFAD7E0074911F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 74A0E3F928CFAE6D0074911F /* WaterfallTrueCompositionalLayout */ = {isa = PBXFileReference; lastKnownFileType = folder; name = WaterfallTrueCompositionalLayout; path = ..; sourceTree = ""; }; 31 | 74A0E3FF28D8A1480074911F /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; 32 | 74A0E40128D8A1D60074911F /* ItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemModel.swift; sourceTree = ""; }; 33 | 74A0E40328D8A28D0074911F /* CollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCell.swift; sourceTree = ""; }; 34 | 74A0E40628D8A6BF0074911F /* UIMenu+Picker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIMenu+Picker.swift"; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 74A0E3D828CFAD7C0074911F /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | 74A0E3FC28CFAE920074911F /* WaterfallTrueCompositionalLayout in Frameworks */, 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 74A0E3D228CFAD7C0074911F = { 50 | isa = PBXGroup; 51 | children = ( 52 | 74A0E3F728CFADF70074911F /* Packages */, 53 | 74A0E3DD28CFAD7C0074911F /* WaterfallTrueCompositionalLayoutDemo */, 54 | 74A0E3DC28CFAD7C0074911F /* Products */, 55 | 74A0E3FA28CFAE920074911F /* Frameworks */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | 74A0E3DC28CFAD7C0074911F /* Products */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 74A0E3DB28CFAD7C0074911F /* WaterfallTrueCompositionalLayoutDemo.app */, 63 | ); 64 | name = Products; 65 | sourceTree = ""; 66 | }; 67 | 74A0E3DD28CFAD7C0074911F /* WaterfallTrueCompositionalLayoutDemo */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 74A0E40528D8A6A10074911F /* Supporting files */, 71 | 74A0E3FD28CFAEA30074911F /* Resources */, 72 | 74A0E3FE28D8A0B50074911F /* Screen */, 73 | ); 74 | path = WaterfallTrueCompositionalLayoutDemo; 75 | sourceTree = ""; 76 | }; 77 | 74A0E3F728CFADF70074911F /* Packages */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 74A0E3F928CFAE6D0074911F /* WaterfallTrueCompositionalLayout */, 81 | ); 82 | name = Packages; 83 | sourceTree = ""; 84 | }; 85 | 74A0E3FA28CFAE920074911F /* Frameworks */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | ); 89 | name = Frameworks; 90 | sourceTree = ""; 91 | }; 92 | 74A0E3FD28CFAEA30074911F /* Resources */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 74A0E3E728CFAD7E0074911F /* Assets.xcassets */, 96 | 74A0E3E928CFAD7E0074911F /* LaunchScreen.storyboard */, 97 | 74A0E3EC28CFAD7E0074911F /* Info.plist */, 98 | ); 99 | path = Resources; 100 | sourceTree = ""; 101 | }; 102 | 74A0E3FE28D8A0B50074911F /* Screen */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 74A0E3E228CFAD7C0074911F /* ViewController.swift */, 106 | 74A0E3FF28D8A1480074911F /* ViewModel.swift */, 107 | 74A0E40128D8A1D60074911F /* ItemModel.swift */, 108 | 74A0E40328D8A28D0074911F /* CollectionViewCell.swift */, 109 | ); 110 | path = Screen; 111 | sourceTree = ""; 112 | }; 113 | 74A0E40528D8A6A10074911F /* Supporting files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 74A0E40628D8A6BF0074911F /* UIMenu+Picker.swift */, 117 | 74A0E3DE28CFAD7C0074911F /* AppDelegate.swift */, 118 | 74A0E3E028CFAD7C0074911F /* SceneDelegate.swift */, 119 | ); 120 | path = "Supporting files"; 121 | sourceTree = ""; 122 | }; 123 | /* End PBXGroup section */ 124 | 125 | /* Begin PBXNativeTarget section */ 126 | 74A0E3DA28CFAD7C0074911F /* WaterfallTrueCompositionalLayoutDemo */ = { 127 | isa = PBXNativeTarget; 128 | buildConfigurationList = 74A0E3EF28CFAD7E0074911F /* Build configuration list for PBXNativeTarget "WaterfallTrueCompositionalLayoutDemo" */; 129 | buildPhases = ( 130 | 74A0E3D728CFAD7C0074911F /* Sources */, 131 | 74A0E3D828CFAD7C0074911F /* Frameworks */, 132 | 74A0E3D928CFAD7C0074911F /* Resources */, 133 | ); 134 | buildRules = ( 135 | ); 136 | dependencies = ( 137 | ); 138 | name = WaterfallTrueCompositionalLayoutDemo; 139 | packageProductDependencies = ( 140 | 74A0E3FB28CFAE920074911F /* WaterfallTrueCompositionalLayout */, 141 | ); 142 | productName = WaterfallTrueCompositionalLayoutDemo; 143 | productReference = 74A0E3DB28CFAD7C0074911F /* WaterfallTrueCompositionalLayoutDemo.app */; 144 | productType = "com.apple.product-type.application"; 145 | }; 146 | /* End PBXNativeTarget section */ 147 | 148 | /* Begin PBXProject section */ 149 | 74A0E3D328CFAD7C0074911F /* Project object */ = { 150 | isa = PBXProject; 151 | attributes = { 152 | BuildIndependentTargetsInParallel = 1; 153 | LastSwiftUpdateCheck = 1310; 154 | LastUpgradeCheck = 1310; 155 | TargetAttributes = { 156 | 74A0E3DA28CFAD7C0074911F = { 157 | CreatedOnToolsVersion = 13.1; 158 | }; 159 | }; 160 | }; 161 | buildConfigurationList = 74A0E3D628CFAD7C0074911F /* Build configuration list for PBXProject "WaterfallTrueCompositionalLayoutDemo" */; 162 | compatibilityVersion = "Xcode 13.0"; 163 | developmentRegion = en; 164 | hasScannedForEncodings = 0; 165 | knownRegions = ( 166 | en, 167 | Base, 168 | ); 169 | mainGroup = 74A0E3D228CFAD7C0074911F; 170 | productRefGroup = 74A0E3DC28CFAD7C0074911F /* Products */; 171 | projectDirPath = ""; 172 | projectRoot = ""; 173 | targets = ( 174 | 74A0E3DA28CFAD7C0074911F /* WaterfallTrueCompositionalLayoutDemo */, 175 | ); 176 | }; 177 | /* End PBXProject section */ 178 | 179 | /* Begin PBXResourcesBuildPhase section */ 180 | 74A0E3D928CFAD7C0074911F /* Resources */ = { 181 | isa = PBXResourcesBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | 74A0E3EB28CFAD7E0074911F /* LaunchScreen.storyboard in Resources */, 185 | 74A0E3E828CFAD7E0074911F /* Assets.xcassets in Resources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXResourcesBuildPhase section */ 190 | 191 | /* Begin PBXSourcesBuildPhase section */ 192 | 74A0E3D728CFAD7C0074911F /* Sources */ = { 193 | isa = PBXSourcesBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | 74A0E40228D8A1D60074911F /* ItemModel.swift in Sources */, 197 | 74A0E40728D8A6BF0074911F /* UIMenu+Picker.swift in Sources */, 198 | 74A0E3E328CFAD7C0074911F /* ViewController.swift in Sources */, 199 | 74A0E40428D8A28D0074911F /* CollectionViewCell.swift in Sources */, 200 | 74A0E3DF28CFAD7C0074911F /* AppDelegate.swift in Sources */, 201 | 74A0E40028D8A1480074911F /* ViewModel.swift in Sources */, 202 | 74A0E3E128CFAD7C0074911F /* SceneDelegate.swift in Sources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | /* End PBXSourcesBuildPhase section */ 207 | 208 | /* Begin PBXVariantGroup section */ 209 | 74A0E3E928CFAD7E0074911F /* LaunchScreen.storyboard */ = { 210 | isa = PBXVariantGroup; 211 | children = ( 212 | 74A0E3EA28CFAD7E0074911F /* Base */, 213 | ); 214 | name = LaunchScreen.storyboard; 215 | sourceTree = ""; 216 | }; 217 | /* End PBXVariantGroup section */ 218 | 219 | /* Begin XCBuildConfiguration section */ 220 | 74A0E3ED28CFAD7E0074911F /* Debug */ = { 221 | isa = XCBuildConfiguration; 222 | buildSettings = { 223 | ALWAYS_SEARCH_USER_PATHS = NO; 224 | CLANG_ANALYZER_NONNULL = YES; 225 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 226 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 227 | CLANG_CXX_LIBRARY = "libc++"; 228 | CLANG_ENABLE_MODULES = YES; 229 | CLANG_ENABLE_OBJC_ARC = YES; 230 | CLANG_ENABLE_OBJC_WEAK = YES; 231 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 232 | CLANG_WARN_BOOL_CONVERSION = YES; 233 | CLANG_WARN_COMMA = YES; 234 | CLANG_WARN_CONSTANT_CONVERSION = YES; 235 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 236 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 237 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 238 | CLANG_WARN_EMPTY_BODY = YES; 239 | CLANG_WARN_ENUM_CONVERSION = YES; 240 | CLANG_WARN_INFINITE_RECURSION = YES; 241 | CLANG_WARN_INT_CONVERSION = YES; 242 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 243 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 244 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 245 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 246 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 247 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 248 | CLANG_WARN_STRICT_PROTOTYPES = YES; 249 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 250 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 251 | CLANG_WARN_UNREACHABLE_CODE = YES; 252 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 253 | COPY_PHASE_STRIP = NO; 254 | DEBUG_INFORMATION_FORMAT = dwarf; 255 | ENABLE_STRICT_OBJC_MSGSEND = YES; 256 | ENABLE_TESTABILITY = YES; 257 | GCC_C_LANGUAGE_STANDARD = gnu11; 258 | GCC_DYNAMIC_NO_PIC = NO; 259 | GCC_NO_COMMON_BLOCKS = YES; 260 | GCC_OPTIMIZATION_LEVEL = 0; 261 | GCC_PREPROCESSOR_DEFINITIONS = ( 262 | "DEBUG=1", 263 | "$(inherited)", 264 | ); 265 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 266 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 267 | GCC_WARN_UNDECLARED_SELECTOR = YES; 268 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 269 | GCC_WARN_UNUSED_FUNCTION = YES; 270 | GCC_WARN_UNUSED_VARIABLE = YES; 271 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 272 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 273 | MTL_FAST_MATH = YES; 274 | ONLY_ACTIVE_ARCH = YES; 275 | SDKROOT = iphoneos; 276 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 277 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 278 | }; 279 | name = Debug; 280 | }; 281 | 74A0E3EE28CFAD7E0074911F /* Release */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ALWAYS_SEARCH_USER_PATHS = NO; 285 | CLANG_ANALYZER_NONNULL = YES; 286 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 287 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 288 | CLANG_CXX_LIBRARY = "libc++"; 289 | CLANG_ENABLE_MODULES = YES; 290 | CLANG_ENABLE_OBJC_ARC = YES; 291 | CLANG_ENABLE_OBJC_WEAK = YES; 292 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 293 | CLANG_WARN_BOOL_CONVERSION = YES; 294 | CLANG_WARN_COMMA = YES; 295 | CLANG_WARN_CONSTANT_CONVERSION = YES; 296 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 297 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 298 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 299 | CLANG_WARN_EMPTY_BODY = YES; 300 | CLANG_WARN_ENUM_CONVERSION = YES; 301 | CLANG_WARN_INFINITE_RECURSION = YES; 302 | CLANG_WARN_INT_CONVERSION = YES; 303 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 304 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 305 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 306 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 307 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 308 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 309 | CLANG_WARN_STRICT_PROTOTYPES = YES; 310 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 311 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 312 | CLANG_WARN_UNREACHABLE_CODE = YES; 313 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 314 | COPY_PHASE_STRIP = NO; 315 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 316 | ENABLE_NS_ASSERTIONS = NO; 317 | ENABLE_STRICT_OBJC_MSGSEND = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu11; 319 | GCC_NO_COMMON_BLOCKS = YES; 320 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 321 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 322 | GCC_WARN_UNDECLARED_SELECTOR = YES; 323 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 324 | GCC_WARN_UNUSED_FUNCTION = YES; 325 | GCC_WARN_UNUSED_VARIABLE = YES; 326 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 327 | MTL_ENABLE_DEBUG_INFO = NO; 328 | MTL_FAST_MATH = YES; 329 | SDKROOT = iphoneos; 330 | SWIFT_COMPILATION_MODE = wholemodule; 331 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 332 | VALIDATE_PRODUCT = YES; 333 | }; 334 | name = Release; 335 | }; 336 | 74A0E3F028CFAD7E0074911F /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 340 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 341 | CODE_SIGN_STYLE = Automatic; 342 | CURRENT_PROJECT_VERSION = 1; 343 | DEVELOPMENT_TEAM = 6T42T57GF6; 344 | GENERATE_INFOPLIST_FILE = YES; 345 | INFOPLIST_FILE = WaterfallTrueCompositionalLayoutDemo/Resources/Info.plist; 346 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 347 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 348 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 349 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 350 | LD_RUNPATH_SEARCH_PATHS = ( 351 | "$(inherited)", 352 | "@executable_path/Frameworks", 353 | ); 354 | MARKETING_VERSION = 1.0; 355 | PRODUCT_BUNDLE_IDENTIFIER = ru.ee.shishko.WaterfallTrueCompositionalLayoutDemo; 356 | PRODUCT_NAME = "$(TARGET_NAME)"; 357 | SWIFT_EMIT_LOC_STRINGS = YES; 358 | SWIFT_VERSION = 5.0; 359 | TARGETED_DEVICE_FAMILY = "1,2"; 360 | }; 361 | name = Debug; 362 | }; 363 | 74A0E3F128CFAD7E0074911F /* Release */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 368 | CODE_SIGN_STYLE = Automatic; 369 | CURRENT_PROJECT_VERSION = 1; 370 | DEVELOPMENT_TEAM = 6T42T57GF6; 371 | GENERATE_INFOPLIST_FILE = YES; 372 | INFOPLIST_FILE = WaterfallTrueCompositionalLayoutDemo/Resources/Info.plist; 373 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 374 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 375 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 376 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 377 | LD_RUNPATH_SEARCH_PATHS = ( 378 | "$(inherited)", 379 | "@executable_path/Frameworks", 380 | ); 381 | MARKETING_VERSION = 1.0; 382 | PRODUCT_BUNDLE_IDENTIFIER = ru.ee.shishko.WaterfallTrueCompositionalLayoutDemo; 383 | PRODUCT_NAME = "$(TARGET_NAME)"; 384 | SWIFT_EMIT_LOC_STRINGS = YES; 385 | SWIFT_VERSION = 5.0; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Release; 389 | }; 390 | /* End XCBuildConfiguration section */ 391 | 392 | /* Begin XCConfigurationList section */ 393 | 74A0E3D628CFAD7C0074911F /* Build configuration list for PBXProject "WaterfallTrueCompositionalLayoutDemo" */ = { 394 | isa = XCConfigurationList; 395 | buildConfigurations = ( 396 | 74A0E3ED28CFAD7E0074911F /* Debug */, 397 | 74A0E3EE28CFAD7E0074911F /* Release */, 398 | ); 399 | defaultConfigurationIsVisible = 0; 400 | defaultConfigurationName = Release; 401 | }; 402 | 74A0E3EF28CFAD7E0074911F /* Build configuration list for PBXNativeTarget "WaterfallTrueCompositionalLayoutDemo" */ = { 403 | isa = XCConfigurationList; 404 | buildConfigurations = ( 405 | 74A0E3F028CFAD7E0074911F /* Debug */, 406 | 74A0E3F128CFAD7E0074911F /* Release */, 407 | ); 408 | defaultConfigurationIsVisible = 0; 409 | defaultConfigurationName = Release; 410 | }; 411 | /* End XCConfigurationList section */ 412 | 413 | /* Begin XCSwiftPackageProductDependency section */ 414 | 74A0E3FB28CFAE920074911F /* WaterfallTrueCompositionalLayout */ = { 415 | isa = XCSwiftPackageProductDependency; 416 | productName = WaterfallTrueCompositionalLayout; 417 | }; 418 | /* End XCSwiftPackageProductDependency section */ 419 | }; 420 | rootObject = 74A0E3D328CFAD7C0074911F /* Project object */; 421 | } 422 | --------------------------------------------------------------------------------