├── CarLensCollectionViewLayoutDemo ├── Supporting files │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard ├── AppDelegate.swift ├── CollectionViewCell.swift └── CollectionViewController.swift ├── CarLensCollectionViewLayout.xcodeproj ├── project.xcworkspace │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcshareddata │ └── xcschemes │ │ ├── CarLensCollectionViewLayout.xcscheme │ │ └── CarLensCollectionViewLayoutDemo.xcscheme └── project.pbxproj ├── .gitignore ├── CarLensCollectionViewLayout ├── CarLensCollectionViewLayout.h ├── Info.plist ├── CarLensLayoutAttributes.swift ├── CarLensCollectionViewLayoutOptions.swift ├── CarLensCollectionViewCell.swift └── CarLensCollectionViewLayout.swift ├── CarLensCollectionViewLayout.podspec ├── LICENSE.md ├── bitrise.yml └── README.md /CarLensCollectionViewLayoutDemo/Supporting files/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CarLensCollectionViewLayout.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayoutDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CarLensCollectionViewDemo 4 | // 5 | // Copyright © 2019 Netguru. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | return true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .Trashes 3 | .localized 4 | 5 | build 6 | .build 7 | xcuserdata 8 | DerivedData 9 | 10 | *.mode1v3 11 | *.mode2v3 12 | *.perspectivev3 13 | *.pbxuser 14 | *.xccheckout 15 | *.xcuserstate 16 | *.xcscmblueprint 17 | *.moved-aside 18 | *.hmap 19 | *.o 20 | *.hmap 21 | *.ipa 22 | *.dSYM.zip 23 | 24 | timeline.xctimeline 25 | playground.xcworkspace 26 | 27 | .idea 28 | *.iml 29 | 30 | Pods 31 | Carthage 32 | Packages 33 | 34 | fastlane/report.xml 35 | fastlane/Preview.html 36 | fastlane/screenshots 37 | fastlane/test_output 38 | 39 | .env 40 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayout/CarLensCollectionViewLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarLensCollectionViewLayout.h 3 | // CarLensCollectionViewLayout 4 | // 5 | // Copyright © 2018 Netguru. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for CarLensCollectionViewLayout. 11 | FOUNDATION_EXPORT double CarLensCollectionViewLayoutVersionNumber; 12 | 13 | //! Project version string for CarLensCollectionViewLayout. 14 | FOUNDATION_EXPORT const unsigned char CarLensCollectionViewLayoutVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayout.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "CarLensCollectionViewLayout" 4 | s.version = "1.2.0" 5 | s.summary = "An easy to use Collection View Layout for card-like animation." 6 | 7 | s.homepage = "https://github.com/netguru/CarLensCollectionViewLayout" 8 | s.license = { :type => "MIT", :file => "LICENSE.md" } 9 | s.authors = { "Anna-Mariia Shkarlinska" => "anna-mariia.shkarlinska@netguru.co", 10 | "Michał Kwiecień" => "michal.kwiecien@netguru.co" } 11 | 12 | s.platform = :ios, "9.0" 13 | s.source = { :git => "https://github.com/netguru/CarLensCollectionViewLayout.git", :tag => "#{s.version}" } 14 | s.source_files = "CarLensCollectionViewLayout/**/*.swift" 15 | s.swift_version = "4.2" 16 | s.framework = "UIKit" 17 | 18 | end -------------------------------------------------------------------------------- /CarLensCollectionViewLayout/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.2.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayout/CarLensLayoutAttributes.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CarLensLayoutAttributes.swift 3 | // CarLensLayoutAttributes 4 | // 5 | // Copyright © 2018 Netguru. All rights reserved. 6 | // 7 | 8 | 9 | import UIKit 10 | 11 | final class CarLensLayoutAttributes: UICollectionViewLayoutAttributes { 12 | 13 | /// Progress towards the center of the screen, value between 0 and 1. 14 | var progress = 0.0 15 | 16 | /// SeeAlso: UICollectionViewLayoutAttributes 17 | override func copy(with zone: NSZone?) -> Any { 18 | let attributes = super.copy(with: zone) 19 | (attributes as? CarLensLayoutAttributes)?.progress = progress 20 | return attributes 21 | } 22 | 23 | /// SeeAlso: UICollectionViewLayoutAttributes 24 | override func isEqual(_ object: Any?) -> Bool { 25 | guard let attributes = object as? CarLensLayoutAttributes, 26 | attributes.progress == progress else { return false } 27 | return super.isEqual(object) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Netguru S.A. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayoutDemo/CollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCell.swift 3 | // CarLensCollectionViewDemo 4 | // 5 | // Copyright © 2019 Netguru. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | import CarLensCollectionViewLayout 10 | 11 | class CollectionViewCell: CarLensCollectionViewCell { 12 | 13 | static let identifier = "CollectionViewCell" 14 | 15 | private var upperView: UILabel = { 16 | var label = UILabel() 17 | label.translatesAutoresizingMaskIntoConstraints = false 18 | label.font = .boldSystemFont(ofSize: 60) 19 | label.textAlignment = .center 20 | label.textColor = .white 21 | label.text = "CarLens" 22 | return label 23 | }() 24 | 25 | private var bottomView: UIView = { 26 | var view = UIView() 27 | view.translatesAutoresizingMaskIntoConstraints = false 28 | view.backgroundColor = .white 29 | view.layer.cornerRadius = 10 30 | return view 31 | }() 32 | 33 | override init(frame: CGRect) { 34 | super.init(frame: frame) 35 | configure(topView: upperView, cardView: bottomView) 36 | } 37 | 38 | required init?(coder aDecoder: NSCoder) { 39 | fatalError("init(coder:) has not been implemented") 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayoutDemo/CollectionViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewController.swift 3 | // CarLensCollectionViewDemo 4 | // 5 | // Copyright © 2019 Netguru. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | import CarLensCollectionViewLayout 10 | 11 | class CollectionViewController: UICollectionViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | setupView() 16 | } 17 | 18 | private func setupView() { 19 | collectionView.backgroundColor = .lightGray 20 | collectionView.register(CollectionViewCell.self, forCellWithReuseIdentifier: CollectionViewCell.identifier) 21 | collectionView.showsHorizontalScrollIndicator = false 22 | collectionView.collectionViewLayout = CarLensCollectionViewLayout() 23 | } 24 | 25 | override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 26 | return 5 27 | } 28 | 29 | override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 30 | guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CollectionViewCell.identifier, for: indexPath) as? CollectionViewCell else { 31 | return UICollectionViewCell() 32 | } 33 | return cell 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayoutDemo/Supporting files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayoutDemo/Supporting files/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /bitrise.yml: -------------------------------------------------------------------------------- 1 | # 2 | # bitrise.yml 3 | # 4 | # Copyright © 2017 Netguru Sp. z o.o. All rights reserved. 5 | # 6 | 7 | # CLI metadata 8 | 9 | format_version: 1.3.1 10 | default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git 11 | 12 | # Workflow trigger map 13 | 14 | trigger_map: 15 | 16 | - pull_request_target_branch: develop 17 | workflow: build 18 | 19 | - push_branch: develop 20 | workflow: build 21 | 22 | # Environment configuration 23 | 24 | app: 25 | envs: 26 | - XCODEBUILD_PROJECT: ./CarLensCollectionViewLayout.xcodeproj 27 | 28 | # Workflow declarations 29 | 30 | workflows: 31 | 32 | # Top level build workflows 33 | 34 | build: 35 | envs: 36 | - XCODEBUILD_SCHEME: CarLensCollectionViewLayout 37 | - XCODEBUILD_SCHEME_DEMO: CarLensCollectionViewLayoutDemo 38 | before_run: 39 | - build-lib 40 | - build-demo 41 | - cocoapods-test 42 | after_run: 43 | - deploy-artifacts 44 | 45 | build-lib: 46 | steps: 47 | - script: 48 | title: build-lib 49 | inputs: 50 | - content: xcodebuild -project $XCODEBUILD_PROJECT -scheme $XCODEBUILD_SCHEME -destination 'platform=iOS Simulator,name=iPhone 7 Plus' 51 | 52 | build-demo: 53 | steps: 54 | - script: 55 | title: build-demo 56 | inputs: 57 | - content: xcodebuild -project $XCODEBUILD_PROJECT -scheme $XCODEBUILD_SCHEME_DEMO -destination 'platform=iOS Simulator,name=iPhone 7 Plus' 58 | 59 | cocoapods-test: 60 | steps: 61 | - script: 62 | title: cocoapods-lint 63 | inputs: 64 | # -- allow-warnings should be removed once repository is public 65 | - content: pod lib lint --allow-warnings 66 | 67 | # Deploy workflows 68 | 69 | deploy-artifacts: 70 | steps: 71 | - deploy-to-bitrise-io: 72 | inputs: 73 | - notify_user_groups: none 74 | - is_enable_public_page: false 75 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayout/CarLensCollectionViewLayoutOptions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CarLensCollectionViewLayoutOptions.swift 3 | // CarLensCollectionViewLayout 4 | // 5 | // Copyright © 2019 Netguru. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /// The optional configuration of CarLensCollectionViewLayout. Use this if you need to customize `CarLensCollectionViewLayout`. 11 | public struct CarLensCollectionViewLayoutOptions { 12 | 13 | /// A minimum spacing between cells. 14 | let minimumSpacing: CGFloat 15 | 16 | /// A deceleration for a scroll view. 17 | let decelerationRate: UIScrollView.DecelerationRate 18 | 19 | /// A value indicating whether collection view should have a scroll indicator. 20 | let shouldShowScrollIndicator: Bool 21 | 22 | /// The size to use for cells. 23 | let itemSize: CGSize? 24 | 25 | /// The initialization of the optional layout configuration. 26 | /// You can initialize it with any of the parameters available. Others will be configured automatically. 27 | /// 28 | /// - Parameters: 29 | /// - minimumSpacing: A minimum spacing between cells. The default value is `20`. 30 | /// - decelerationRate: A deceleration for a scroll view. The default value is `.fast`. 31 | /// - shouldShowScrollIndicator: A value indicating whether collection view should have a scroll indicator. The default value is `false`. 32 | /// - itemSize: The size to use for cells. The default height is equal to a collection view height. The width is equal to the `collection view width - 60`. 33 | public init(minimumSpacing: CGFloat = 20, decelerationRate: UIScrollView.DecelerationRate = UIScrollView.DecelerationRate.fast, shouldShowScrollIndicator: Bool = false, itemSize: CGSize? = nil) { 34 | self.minimumSpacing = minimumSpacing 35 | self.decelerationRate = decelerationRate 36 | self.shouldShowScrollIndicator = shouldShowScrollIndicator 37 | self.itemSize = itemSize 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayoutDemo/Supporting files/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /CarLensCollectionViewLayout/CarLensCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CarLensCollectionViewCell.swift 3 | // CarLensCollectionViewCell 4 | // 5 | // Copyright © 2018 Netguru. All rights reserved. 6 | // 7 | 8 | 9 | import UIKit.UICollectionView 10 | 11 | open class CarLensCollectionViewCell: UICollectionViewCell { 12 | 13 | /// Indicates if the cell is currently displayed as primary cell. 14 | public var isCurrentlyPrimary = false 15 | 16 | /// The upper view of the cell. 17 | public var topView: UIView! 18 | 19 | /// The bottom view of the cell. 20 | public var cardView: UIView! 21 | 22 | /// The height of the top view. 23 | public var topViewHeight: CGFloat! 24 | 25 | /// Configuration of the cell. Must be called on a start. 26 | /// 27 | /// - Parameters: 28 | /// - topView: The upper view of the cell. 29 | /// - cardView: The bottom view of the cell. 30 | /// - topViewHeight: An optional parameter to specify the custom height of the top view. The default value is `200` depending on a device's size. 31 | open func configure(topView: UIView, cardView: UIView, topViewHeight: CGFloat = 200) { 32 | self.topViewHeight = topViewHeight 33 | self.topView = topView 34 | self.cardView = cardView 35 | setupView() 36 | } 37 | 38 | private func animateViews(toProgress progress: Double) { 39 | let offset = topViewHeight - (CGFloat(progress) * topViewHeight) 40 | cardView.transform = .init(translationX: 0, y: -offset) 41 | } 42 | 43 | private func setupView() { 44 | [topView, cardView].forEach(contentView.addSubview) 45 | NSLayoutConstraint.activate([ 46 | topView.topAnchor.constraint(equalTo: topAnchor), 47 | topView.leadingAnchor.constraint(equalTo: leadingAnchor), 48 | topView.trailingAnchor.constraint(equalTo: trailingAnchor), 49 | topView.heightAnchor.constraint(equalToConstant: topViewHeight), 50 | cardView.bottomAnchor.constraint(equalTo: bottomAnchor), 51 | cardView.leadingAnchor.constraint(equalTo: leadingAnchor), 52 | cardView.trailingAnchor.constraint(equalTo: trailingAnchor), 53 | cardView.topAnchor.constraint(equalTo: topView.bottomAnchor) 54 | ]) 55 | } 56 | 57 | /// - SeeAlso: UICollectionViewCell 58 | open override func apply(_ layoutAttributes: UICollectionViewLayoutAttributes) { 59 | super.apply(layoutAttributes) 60 | guard let attributes = layoutAttributes as? CarLensLayoutAttributes else { return } 61 | isCurrentlyPrimary = !(attributes.progress == 0) 62 | animateViews(toProgress: attributes.progress) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayoutDemo/Supporting files/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayout.xcodeproj/xcshareddata/xcschemes/CarLensCollectionViewLayout.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayout.xcodeproj/xcshareddata/xcschemes/CarLensCollectionViewLayoutDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayout/CarLensCollectionViewLayout.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CarLensCollectionViewLayout.swift 3 | // CarLensCollectionViewLayout 4 | // 5 | // Copyright © 2018 Netguru. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | public final class CarLensCollectionViewLayout: UICollectionViewFlowLayout { 11 | 12 | private var firstSetupDone = false 13 | 14 | private let options: CarLensCollectionViewLayoutOptions 15 | 16 | /// SeeAlso: UICollectionViewFlowLayout 17 | public override func prepare() { 18 | super.prepare() 19 | guard !firstSetupDone else { return } 20 | setup() 21 | firstSetupDone = true 22 | } 23 | 24 | 25 | /// The initialization of the CarLensCollectionViewLayout. 26 | /// 27 | /// - Parameters: 28 | /// - options: An optional additional configuration of the layout. 29 | public init(options: CarLensCollectionViewLayoutOptions = CarLensCollectionViewLayoutOptions()) { 30 | self.options = options 31 | super.init() 32 | } 33 | 34 | public required init?(coder aDecoder: NSCoder) { 35 | self.options = CarLensCollectionViewLayoutOptions() 36 | super.init(coder: aDecoder) 37 | } 38 | 39 | private func setup() { 40 | guard let collectionView = collectionView else { return } 41 | scrollDirection = .horizontal 42 | minimumLineSpacing = options.minimumSpacing 43 | itemSize = options.itemSize ?? CGSize(width: collectionView.bounds.width - 60, height: collectionView.bounds.height) 44 | let sidesInset = (collectionView.bounds.width - itemSize.width) / 2 45 | let topAndBottomInset = (collectionView.bounds.height - itemSize.height) / 2 46 | collectionView.contentInset = .init(top: topAndBottomInset, left: sidesInset, bottom: topAndBottomInset, right: sidesInset) 47 | collectionView.decelerationRate = options.decelerationRate 48 | collectionView.showsHorizontalScrollIndicator = options.shouldShowScrollIndicator 49 | } 50 | 51 | /// SeeAlso: UICollectionViewFlowLayout 52 | public override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool { 53 | return true 54 | } 55 | 56 | /// SeeAlso: UICollectionViewFlowLayout 57 | public override class var layoutAttributesClass: AnyClass { 58 | return CarLensLayoutAttributes.self 59 | } 60 | 61 | /// SeeAlso: UICollectionViewFlowLayout 62 | public override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { 63 | guard let collectionView = collectionView, let allAttributes = super.layoutAttributesForElements(in: rect) else { return nil } 64 | for attributes in allAttributes { 65 | let collectionCenter = collectionView.bounds.size.width / 2 66 | let offset = collectionView.contentOffset.x 67 | let normalizedCenter = attributes.center.x - offset 68 | 69 | let maxDistance = itemSize.width + minimumLineSpacing 70 | let distanceFromCenter = min(collectionCenter - normalizedCenter, maxDistance) 71 | let ratio = (maxDistance - abs(distanceFromCenter)) / maxDistance 72 | let normalizedRatio = min(1, max(0, ratio)) 73 | 74 | guard let attributes = attributes as? CarLensLayoutAttributes else { continue } 75 | attributes.progress = Double(normalizedRatio) 76 | } 77 | return allAttributes 78 | } 79 | 80 | /// SeeAlso: UICollectionViewFlowLayout 81 | public override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint { 82 | guard let collectionView = collectionView, let layoutAttributes = layoutAttributesForElements(in: collectionView.bounds) else { 83 | return .init(x: 0, y: 0) 84 | } 85 | // Snapping closest cell to the center 86 | let centerOffset = collectionView.bounds.size.width / 2 87 | let offsetWithCenter = proposedContentOffset.x + (proposedContentOffset.x * velocity.x) + centerOffset 88 | let closestAttribute = layoutAttributes 89 | .sorted { abs($0.center.x - offsetWithCenter) < abs($1.center.x - offsetWithCenter) } 90 | .first ?? UICollectionViewLayoutAttributes() 91 | return CGPoint(x: closestAttribute.center.x - centerOffset, y: 0) 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CarLensCollectionViewLayout 2 | 3 | ![](https://img.shields.io/badge/swift-4.2-orange.svg) 4 | ![](https://img.shields.io/badge/cocoapods-compatible-green.svg) 5 | ![](https://img.shields.io/badge/carthage-compatible-green.svg) 6 | ![](https://app.bitrise.io/app/23a07b63b3f55f97/status.svg?token=Rt_2gKUavbR8LQ7PVuTbYg&branch=master) 7 | 8 | An easy-to-use Collection View Layout for card-like animation 🎉 9 | 10 |

11 | 12 |

13 | 14 | *CarLensCollectionViewLayout* was created out of the implementation in [**CarLens** application 🚘](https://github.com/netguru/car-recognition-ios). The image above exactly shows the screen from the app! 15 | 16 | ## Requirements 17 | 18 | *CarLensCollectionViewLayout* is written in **Swift 4.2** and supports **iOS 9.0+**. 19 | 20 | 21 | ## Usage 22 | 23 | ### Basic Usage 24 | 25 | The two main steps are needed for the configuration of *CarLensCollectionViewLayout*: 26 | 27 | #### Step 1 28 | Assign `CarLensCollectionViewLayout` to yours collection view layout: 29 | ```swift 30 | collectionView.collectionViewLayout = CarLensCollectionViewLayout() 31 | ``` 32 | or initialize your collection view with `CarLensCollectionViewLayout`: 33 | ```swift 34 | UICollectionView(frame: .zero, collectionViewLayout: CarLensCollectionViewLayout()) 35 | ``` 36 | 37 | #### Step 2 38 | Subsclass `CarLensCollectionViewCell` and call `configure(topView: UIView, cardView: UIView)` during the cell’s initialization: 39 | ```swift 40 | class CollectionViewCell: CarLensCollectionViewCell { 41 | override init(frame: CGRect) { 42 | super.init(frame: frame) 43 | configure(topView: upperView, cardView: bottomView) 44 | } 45 | } 46 | ``` 47 | The sample implementation is available in [Demo](CarLensCollectionViewLayoutDemo) project. 48 | 49 | ### Customization 50 | 51 | #### Layout 52 | You can also initialize `CarLensCollectionViewLayout` with a `CarLensCollectionViewLayoutOptions` object by passing any of the parameters available. Others will be configured automatically. 53 | 54 | **Parameters:** 55 | 56 | `minimumSpacing` - A minimum spacing between cells. 57 | 58 | `decelerationRate` - A deceleration for a scroll view. 59 | 60 | `shouldShowScrollIndicator` - A value indicating whether collection view should have a scroll indicator. 61 | 62 | `itemSize` - The size to use for cells. 63 | 64 | Example: 65 | ```swift 66 | let options = CarLensCollectionViewLayoutOptions(minimumSpacing: 40) 67 | collectionView.collectionViewLayout = CarLensCollectionViewLayout(options: options) 68 | ``` 69 | 70 | #### Cell 71 | While subsclassing `CarLensCollectionViewCell` you can call `configure(...)` with an additional parameter `topViewHeight`. The card view height will be calculated based on this value. 72 | 73 | Example: 74 | ```swift 75 | class CollectionViewCell: CarLensCollectionViewCell { 76 | override init(frame: CGRect) { 77 | super.init(frame: frame) 78 | configure(topView: upperView, cardView: bottomView, topViewHeight: 300) 79 | } 80 | } 81 | ``` 82 |

83 | 84 | 85 |

86 | 87 | ## Installation 88 | 89 | ### CocoaPods 90 | 91 | If you're using [CocoaPods](http://cocoapods.org), add the following dependency to your `Podfile`: 92 | 93 | ```none 94 | use_frameworks! 95 | pod 'CarLensCollectionViewLayout', '~> 1.2.0' 96 | ``` 97 | 98 | ### Carthage 99 | 100 | If you're using [Carthage](https://github.com/Carthage/Carthage), add the following dependency to your `Cartfile`: 101 | 102 | ```none 103 | github "netguru/CarLensCollectionViewLayout" ~> 1.2.0 104 | ``` 105 | 106 | ## About 107 | 108 | This project is made with ❤️ by [Netguru](https://netguru.co) and maintained by [Anna-Mariia Shkarlinska](https://github.com/anyashka). 109 | 110 | ### License 111 | 112 | *CarLensCollectionViewLayout* is licensed under the MIT License. See [LICENSE.md](LICENSE.md) for more info. 113 | 114 | ## Read More 115 | 116 | - [Introducing CarLensCollectionViewLayout - a New Open Source iOS Tool by Netguru](https://www.netguru.com/codestories/introducing-carlenscollectionviewlayout-a-new-open-source-ios-tool-by-netguru) 117 | - [How We Built CarLens](https://www.netguru.com/blog/machine-learning-and-augmented-reality-combined-in-one-sleek-mobile-app-how-we-built-car-lens) 118 | - [Increasing the Accuracy of the Machine Learning Model in CarLens](https://www.netguru.com/blog/improving-machine-learning-model-carlens-case-study) 119 | 120 | ## Related Links 121 | 122 | - [CarLens Page](https://www.netguru.com/carlens) 123 | - [CarLens iOS](https://github.com/netguru/CarLens-iOS) 124 | - [CarLens in App Store](https://itunes.apple.com/us/app/carlens/id1417168518?mt=8) 125 | - [CarLens Android](https://github.com/netguru/CarLens-Android) 126 | - [CarLens on Google Play](https://play.google.com/store/apps/details?id=co.netguru.android.carrecognition&hl=en) 127 | -------------------------------------------------------------------------------- /CarLensCollectionViewLayout.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9505725E21D4D8FB009EA422 /* CarLensCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9505725D21D4D8FB009EA422 /* CarLensCollectionViewLayout.swift */; }; 11 | 9505726021D4D922009EA422 /* CarLensLayoutAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9505725F21D4D922009EA422 /* CarLensLayoutAttributes.swift */; }; 12 | 9518381D21E4F04400BEA6EB /* CarLensCollectionViewLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 955E4FCF21CBFB2800B4C3BB /* CarLensCollectionViewLayout.framework */; }; 13 | 9518381E21E4F04400BEA6EB /* CarLensCollectionViewLayout.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 955E4FCF21CBFB2800B4C3BB /* CarLensCollectionViewLayout.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9518383121E4F09900BEA6EB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9518382721E4F08300BEA6EB /* Main.storyboard */; }; 15 | 9518383321E4F0B500BEA6EB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9518382521E4F08300BEA6EB /* LaunchScreen.storyboard */; }; 16 | 9518383721E4F31C00BEA6EB /* CollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9518382321E4F08300BEA6EB /* CollectionViewController.swift */; }; 17 | 9518383821E4F31F00BEA6EB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9518382421E4F08300BEA6EB /* Assets.xcassets */; }; 18 | 9518383921E4F32800BEA6EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9518382921E4F08300BEA6EB /* AppDelegate.swift */; }; 19 | 9518383C21E4FFCA00BEA6EB /* CollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9518383B21E4FFCA00BEA6EB /* CollectionViewCell.swift */; }; 20 | 9518384821E623E800BEA6EB /* CarLensCollectionViewLayoutOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9518384721E623E800BEA6EB /* CarLensCollectionViewLayoutOptions.swift */; }; 21 | 955E4FD421CBFB2800B4C3BB /* CarLensCollectionViewLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 955E4FD221CBFB2800B4C3BB /* CarLensCollectionViewLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 22 | 958D17C021D66DF00067BED6 /* CarLensCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 958D17BF21D66DF00067BED6 /* CarLensCollectionViewCell.swift */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 9518383521E4F16700BEA6EB /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 955E4FC621CBFB2800B4C3BB /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 955E4FCE21CBFB2800B4C3BB; 31 | remoteInfo = CarLensCollectionViewLayout; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXCopyFilesBuildPhase section */ 36 | 9518382121E4F04400BEA6EB /* Embed Frameworks */ = { 37 | isa = PBXCopyFilesBuildPhase; 38 | buildActionMask = 2147483647; 39 | dstPath = ""; 40 | dstSubfolderSpec = 10; 41 | files = ( 42 | 9518381E21E4F04400BEA6EB /* CarLensCollectionViewLayout.framework in Embed Frameworks */, 43 | ); 44 | name = "Embed Frameworks"; 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXCopyFilesBuildPhase section */ 48 | 49 | /* Begin PBXFileReference section */ 50 | 9505725D21D4D8FB009EA422 /* CarLensCollectionViewLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarLensCollectionViewLayout.swift; sourceTree = ""; }; 51 | 9505725F21D4D922009EA422 /* CarLensLayoutAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CarLensLayoutAttributes.swift; sourceTree = ""; }; 52 | 9518380B21E4F00000BEA6EB /* CarLensCollectionViewLayoutDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CarLensCollectionViewLayoutDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 9518382321E4F08300BEA6EB /* CollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewController.swift; sourceTree = ""; }; 54 | 9518382421E4F08300BEA6EB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55 | 9518382621E4F08300BEA6EB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 56 | 9518382821E4F08300BEA6EB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 9518382921E4F08300BEA6EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 58 | 9518382A21E4F08300BEA6EB /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | 9518383B21E4FFCA00BEA6EB /* CollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCell.swift; sourceTree = ""; }; 60 | 9518384721E623E800BEA6EB /* CarLensCollectionViewLayoutOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CarLensCollectionViewLayoutOptions.swift; sourceTree = ""; }; 61 | 955E4FCF21CBFB2800B4C3BB /* CarLensCollectionViewLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CarLensCollectionViewLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 955E4FD221CBFB2800B4C3BB /* CarLensCollectionViewLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CarLensCollectionViewLayout.h; sourceTree = ""; }; 63 | 955E4FD321CBFB2800B4C3BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | 958D17BF21D66DF00067BED6 /* CarLensCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CarLensCollectionViewCell.swift; sourceTree = ""; }; 65 | /* End PBXFileReference section */ 66 | 67 | /* Begin PBXFrameworksBuildPhase section */ 68 | 9518380821E4F00000BEA6EB /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | 9518381D21E4F04400BEA6EB /* CarLensCollectionViewLayout.framework in Frameworks */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | 955E4FCC21CBFB2800B4C3BB /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 9518382221E4F08300BEA6EB /* CarLensCollectionViewLayoutDemo */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 9518382921E4F08300BEA6EB /* AppDelegate.swift */, 90 | 9518382321E4F08300BEA6EB /* CollectionViewController.swift */, 91 | 9518383B21E4FFCA00BEA6EB /* CollectionViewCell.swift */, 92 | 9518384121E5166100BEA6EB /* Supporting files */, 93 | ); 94 | path = CarLensCollectionViewLayoutDemo; 95 | sourceTree = ""; 96 | }; 97 | 9518384121E5166100BEA6EB /* Supporting files */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 9518382421E4F08300BEA6EB /* Assets.xcassets */, 101 | 9518382521E4F08300BEA6EB /* LaunchScreen.storyboard */, 102 | 9518382721E4F08300BEA6EB /* Main.storyboard */, 103 | 9518382A21E4F08300BEA6EB /* Info.plist */, 104 | ); 105 | path = "Supporting files"; 106 | sourceTree = ""; 107 | }; 108 | 955E4FC521CBFB2800B4C3BB = { 109 | isa = PBXGroup; 110 | children = ( 111 | 9518382221E4F08300BEA6EB /* CarLensCollectionViewLayoutDemo */, 112 | 955E4FD121CBFB2800B4C3BB /* CarLensCollectionViewLayout */, 113 | 955E4FD021CBFB2800B4C3BB /* Products */, 114 | ); 115 | sourceTree = ""; 116 | }; 117 | 955E4FD021CBFB2800B4C3BB /* Products */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 955E4FCF21CBFB2800B4C3BB /* CarLensCollectionViewLayout.framework */, 121 | 9518380B21E4F00000BEA6EB /* CarLensCollectionViewLayoutDemo.app */, 122 | ); 123 | name = Products; 124 | sourceTree = ""; 125 | }; 126 | 955E4FD121CBFB2800B4C3BB /* CarLensCollectionViewLayout */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 955E4FD221CBFB2800B4C3BB /* CarLensCollectionViewLayout.h */, 130 | 9505725D21D4D8FB009EA422 /* CarLensCollectionViewLayout.swift */, 131 | 9518384721E623E800BEA6EB /* CarLensCollectionViewLayoutOptions.swift */, 132 | 958D17BF21D66DF00067BED6 /* CarLensCollectionViewCell.swift */, 133 | 9505725F21D4D922009EA422 /* CarLensLayoutAttributes.swift */, 134 | 955E4FD321CBFB2800B4C3BB /* Info.plist */, 135 | ); 136 | path = CarLensCollectionViewLayout; 137 | sourceTree = ""; 138 | }; 139 | /* End PBXGroup section */ 140 | 141 | /* Begin PBXHeadersBuildPhase section */ 142 | 955E4FCA21CBFB2800B4C3BB /* Headers */ = { 143 | isa = PBXHeadersBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 955E4FD421CBFB2800B4C3BB /* CarLensCollectionViewLayout.h in Headers */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | /* End PBXHeadersBuildPhase section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | 9518380A21E4F00000BEA6EB /* CarLensCollectionViewLayoutDemo */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = 9518381A21E4F00200BEA6EB /* Build configuration list for PBXNativeTarget "CarLensCollectionViewLayoutDemo" */; 156 | buildPhases = ( 157 | 9518380721E4F00000BEA6EB /* Sources */, 158 | 9518380821E4F00000BEA6EB /* Frameworks */, 159 | 9518380921E4F00000BEA6EB /* Resources */, 160 | 9518382121E4F04400BEA6EB /* Embed Frameworks */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | 9518383621E4F16700BEA6EB /* PBXTargetDependency */, 166 | ); 167 | name = CarLensCollectionViewLayoutDemo; 168 | productName = Example; 169 | productReference = 9518380B21E4F00000BEA6EB /* CarLensCollectionViewLayoutDemo.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | 955E4FCE21CBFB2800B4C3BB /* CarLensCollectionViewLayout */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 955E4FD721CBFB2800B4C3BB /* Build configuration list for PBXNativeTarget "CarLensCollectionViewLayout" */; 175 | buildPhases = ( 176 | 955E4FCA21CBFB2800B4C3BB /* Headers */, 177 | 955E4FCB21CBFB2800B4C3BB /* Sources */, 178 | 955E4FCC21CBFB2800B4C3BB /* Frameworks */, 179 | 955E4FCD21CBFB2800B4C3BB /* Resources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | ); 185 | name = CarLensCollectionViewLayout; 186 | productName = CarlensCollectionViewLayout; 187 | productReference = 955E4FCF21CBFB2800B4C3BB /* CarLensCollectionViewLayout.framework */; 188 | productType = "com.apple.product-type.framework"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 955E4FC621CBFB2800B4C3BB /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastSwiftUpdateCheck = 1010; 197 | LastUpgradeCheck = 1010; 198 | ORGANIZATIONNAME = Netguru; 199 | TargetAttributes = { 200 | 9518380A21E4F00000BEA6EB = { 201 | CreatedOnToolsVersion = 10.1; 202 | }; 203 | 955E4FCE21CBFB2800B4C3BB = { 204 | CreatedOnToolsVersion = 10.1; 205 | }; 206 | }; 207 | }; 208 | buildConfigurationList = 955E4FC921CBFB2800B4C3BB /* Build configuration list for PBXProject "CarLensCollectionViewLayout" */; 209 | compatibilityVersion = "Xcode 9.3"; 210 | developmentRegion = en; 211 | hasScannedForEncodings = 0; 212 | knownRegions = ( 213 | en, 214 | Base, 215 | ); 216 | mainGroup = 955E4FC521CBFB2800B4C3BB; 217 | productRefGroup = 955E4FD021CBFB2800B4C3BB /* Products */; 218 | projectDirPath = ""; 219 | projectRoot = ""; 220 | targets = ( 221 | 955E4FCE21CBFB2800B4C3BB /* CarLensCollectionViewLayout */, 222 | 9518380A21E4F00000BEA6EB /* CarLensCollectionViewLayoutDemo */, 223 | ); 224 | }; 225 | /* End PBXProject section */ 226 | 227 | /* Begin PBXResourcesBuildPhase section */ 228 | 9518380921E4F00000BEA6EB /* Resources */ = { 229 | isa = PBXResourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 9518383321E4F0B500BEA6EB /* LaunchScreen.storyboard in Resources */, 233 | 9518383821E4F31F00BEA6EB /* Assets.xcassets in Resources */, 234 | 9518383121E4F09900BEA6EB /* Main.storyboard in Resources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | 955E4FCD21CBFB2800B4C3BB /* Resources */ = { 239 | isa = PBXResourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXResourcesBuildPhase section */ 246 | 247 | /* Begin PBXSourcesBuildPhase section */ 248 | 9518380721E4F00000BEA6EB /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | 9518383921E4F32800BEA6EB /* AppDelegate.swift in Sources */, 253 | 9518383721E4F31C00BEA6EB /* CollectionViewController.swift in Sources */, 254 | 9518383C21E4FFCA00BEA6EB /* CollectionViewCell.swift in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | 955E4FCB21CBFB2800B4C3BB /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 9518384821E623E800BEA6EB /* CarLensCollectionViewLayoutOptions.swift in Sources */, 263 | 9505725E21D4D8FB009EA422 /* CarLensCollectionViewLayout.swift in Sources */, 264 | 958D17C021D66DF00067BED6 /* CarLensCollectionViewCell.swift in Sources */, 265 | 9505726021D4D922009EA422 /* CarLensLayoutAttributes.swift in Sources */, 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | /* End PBXSourcesBuildPhase section */ 270 | 271 | /* Begin PBXTargetDependency section */ 272 | 9518383621E4F16700BEA6EB /* PBXTargetDependency */ = { 273 | isa = PBXTargetDependency; 274 | target = 955E4FCE21CBFB2800B4C3BB /* CarLensCollectionViewLayout */; 275 | targetProxy = 9518383521E4F16700BEA6EB /* PBXContainerItemProxy */; 276 | }; 277 | /* End PBXTargetDependency section */ 278 | 279 | /* Begin PBXVariantGroup section */ 280 | 9518382521E4F08300BEA6EB /* LaunchScreen.storyboard */ = { 281 | isa = PBXVariantGroup; 282 | children = ( 283 | 9518382621E4F08300BEA6EB /* Base */, 284 | ); 285 | name = LaunchScreen.storyboard; 286 | sourceTree = ""; 287 | }; 288 | 9518382721E4F08300BEA6EB /* Main.storyboard */ = { 289 | isa = PBXVariantGroup; 290 | children = ( 291 | 9518382821E4F08300BEA6EB /* Base */, 292 | ); 293 | name = Main.storyboard; 294 | sourceTree = ""; 295 | }; 296 | /* End PBXVariantGroup section */ 297 | 298 | /* Begin XCBuildConfiguration section */ 299 | 9518381B21E4F00200BEA6EB /* Debug */ = { 300 | isa = XCBuildConfiguration; 301 | buildSettings = { 302 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 303 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 304 | CODE_SIGN_STYLE = Manual; 305 | DEVELOPMENT_TEAM = ""; 306 | INFOPLIST_FILE = "$(SRCROOT)/CarLensCollectionViewLayoutDemo/Supporting Files/Info.plist"; 307 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 308 | LD_RUNPATH_SEARCH_PATHS = ( 309 | "$(inherited)", 310 | "@executable_path/Frameworks", 311 | ); 312 | PRODUCT_BUNDLE_IDENTIFIER = co.netguru.lib.CarLensCollectionViewLayoutDemo; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | PROVISIONING_PROFILE_SPECIFIER = ""; 315 | SWIFT_VERSION = 4.2; 316 | TARGETED_DEVICE_FAMILY = "1,2"; 317 | }; 318 | name = Debug; 319 | }; 320 | 9518381C21E4F00200BEA6EB /* Release */ = { 321 | isa = XCBuildConfiguration; 322 | buildSettings = { 323 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 324 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 325 | CODE_SIGN_STYLE = Manual; 326 | DEVELOPMENT_TEAM = ""; 327 | INFOPLIST_FILE = "$(SRCROOT)/CarLensCollectionViewLayoutDemo/Supporting Files/Info.plist"; 328 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 329 | LD_RUNPATH_SEARCH_PATHS = ( 330 | "$(inherited)", 331 | "@executable_path/Frameworks", 332 | ); 333 | PRODUCT_BUNDLE_IDENTIFIER = co.netguru.lib.CarLensCollectionViewLayoutDemo; 334 | PRODUCT_NAME = "$(TARGET_NAME)"; 335 | PROVISIONING_PROFILE_SPECIFIER = ""; 336 | SWIFT_VERSION = 4.2; 337 | TARGETED_DEVICE_FAMILY = "1,2"; 338 | }; 339 | name = Release; 340 | }; 341 | 955E4FD521CBFB2800B4C3BB /* Debug */ = { 342 | isa = XCBuildConfiguration; 343 | buildSettings = { 344 | ALWAYS_SEARCH_USER_PATHS = NO; 345 | CLANG_ANALYZER_NONNULL = YES; 346 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 347 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 348 | CLANG_CXX_LIBRARY = "libc++"; 349 | CLANG_ENABLE_MODULES = YES; 350 | CLANG_ENABLE_OBJC_ARC = YES; 351 | CLANG_ENABLE_OBJC_WEAK = YES; 352 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 353 | CLANG_WARN_BOOL_CONVERSION = YES; 354 | CLANG_WARN_COMMA = YES; 355 | CLANG_WARN_CONSTANT_CONVERSION = YES; 356 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 357 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 358 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 359 | CLANG_WARN_EMPTY_BODY = YES; 360 | CLANG_WARN_ENUM_CONVERSION = YES; 361 | CLANG_WARN_INFINITE_RECURSION = YES; 362 | CLANG_WARN_INT_CONVERSION = YES; 363 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 364 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 365 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 366 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 367 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 368 | CLANG_WARN_STRICT_PROTOTYPES = YES; 369 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 370 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 371 | CLANG_WARN_UNREACHABLE_CODE = YES; 372 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 373 | CODE_SIGN_IDENTITY = "iPhone Developer"; 374 | COPY_PHASE_STRIP = NO; 375 | CURRENT_PROJECT_VERSION = 1; 376 | DEBUG_INFORMATION_FORMAT = dwarf; 377 | ENABLE_STRICT_OBJC_MSGSEND = YES; 378 | ENABLE_TESTABILITY = YES; 379 | GCC_C_LANGUAGE_STANDARD = gnu11; 380 | GCC_DYNAMIC_NO_PIC = NO; 381 | GCC_NO_COMMON_BLOCKS = YES; 382 | GCC_OPTIMIZATION_LEVEL = 0; 383 | GCC_PREPROCESSOR_DEFINITIONS = ( 384 | "DEBUG=1", 385 | "$(inherited)", 386 | ); 387 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 388 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 389 | GCC_WARN_UNDECLARED_SELECTOR = YES; 390 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 391 | GCC_WARN_UNUSED_FUNCTION = YES; 392 | GCC_WARN_UNUSED_VARIABLE = YES; 393 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 394 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 395 | MTL_FAST_MATH = YES; 396 | ONLY_ACTIVE_ARCH = YES; 397 | SDKROOT = iphoneos; 398 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 399 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 400 | VERSIONING_SYSTEM = "apple-generic"; 401 | VERSION_INFO_PREFIX = ""; 402 | }; 403 | name = Debug; 404 | }; 405 | 955E4FD621CBFB2800B4C3BB /* Release */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | ALWAYS_SEARCH_USER_PATHS = NO; 409 | CLANG_ANALYZER_NONNULL = YES; 410 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 411 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 412 | CLANG_CXX_LIBRARY = "libc++"; 413 | CLANG_ENABLE_MODULES = YES; 414 | CLANG_ENABLE_OBJC_ARC = YES; 415 | CLANG_ENABLE_OBJC_WEAK = YES; 416 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 417 | CLANG_WARN_BOOL_CONVERSION = YES; 418 | CLANG_WARN_COMMA = YES; 419 | CLANG_WARN_CONSTANT_CONVERSION = YES; 420 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 421 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 422 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 423 | CLANG_WARN_EMPTY_BODY = YES; 424 | CLANG_WARN_ENUM_CONVERSION = YES; 425 | CLANG_WARN_INFINITE_RECURSION = YES; 426 | CLANG_WARN_INT_CONVERSION = YES; 427 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 428 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 429 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 430 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 431 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 432 | CLANG_WARN_STRICT_PROTOTYPES = YES; 433 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 434 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 435 | CLANG_WARN_UNREACHABLE_CODE = YES; 436 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 437 | CODE_SIGN_IDENTITY = "iPhone Developer"; 438 | COPY_PHASE_STRIP = NO; 439 | CURRENT_PROJECT_VERSION = 1; 440 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 441 | ENABLE_NS_ASSERTIONS = NO; 442 | ENABLE_STRICT_OBJC_MSGSEND = YES; 443 | GCC_C_LANGUAGE_STANDARD = gnu11; 444 | GCC_NO_COMMON_BLOCKS = YES; 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 447 | GCC_WARN_UNDECLARED_SELECTOR = YES; 448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 449 | GCC_WARN_UNUSED_FUNCTION = YES; 450 | GCC_WARN_UNUSED_VARIABLE = YES; 451 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 452 | MTL_ENABLE_DEBUG_INFO = NO; 453 | MTL_FAST_MATH = YES; 454 | SDKROOT = iphoneos; 455 | SWIFT_COMPILATION_MODE = wholemodule; 456 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 457 | VALIDATE_PRODUCT = YES; 458 | VERSIONING_SYSTEM = "apple-generic"; 459 | VERSION_INFO_PREFIX = ""; 460 | }; 461 | name = Release; 462 | }; 463 | 955E4FD821CBFB2800B4C3BB /* Debug */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | CODE_SIGN_IDENTITY = ""; 467 | CODE_SIGN_STYLE = Manual; 468 | DEFINES_MODULE = YES; 469 | DEVELOPMENT_TEAM = ""; 470 | DYLIB_COMPATIBILITY_VERSION = 1; 471 | DYLIB_CURRENT_VERSION = 1; 472 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 473 | INFOPLIST_FILE = CarlensCollectionViewLayout/Info.plist; 474 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 475 | LD_RUNPATH_SEARCH_PATHS = ( 476 | "$(inherited)", 477 | "@executable_path/Frameworks", 478 | "@loader_path/Frameworks", 479 | ); 480 | PRODUCT_BUNDLE_IDENTIFIER = co.netguru.lib.CarLensCollectionViewLayout; 481 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 482 | PROVISIONING_PROFILE_SPECIFIER = ""; 483 | SKIP_INSTALL = YES; 484 | SWIFT_VERSION = 4.2; 485 | TARGETED_DEVICE_FAMILY = "1,2"; 486 | }; 487 | name = Debug; 488 | }; 489 | 955E4FD921CBFB2800B4C3BB /* Release */ = { 490 | isa = XCBuildConfiguration; 491 | buildSettings = { 492 | CODE_SIGN_IDENTITY = ""; 493 | CODE_SIGN_STYLE = Manual; 494 | DEFINES_MODULE = YES; 495 | DEVELOPMENT_TEAM = ""; 496 | DYLIB_COMPATIBILITY_VERSION = 1; 497 | DYLIB_CURRENT_VERSION = 1; 498 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 499 | INFOPLIST_FILE = CarlensCollectionViewLayout/Info.plist; 500 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 501 | LD_RUNPATH_SEARCH_PATHS = ( 502 | "$(inherited)", 503 | "@executable_path/Frameworks", 504 | "@loader_path/Frameworks", 505 | ); 506 | PRODUCT_BUNDLE_IDENTIFIER = co.netguru.lib.CarLensCollectionViewLayout; 507 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 508 | PROVISIONING_PROFILE_SPECIFIER = ""; 509 | SKIP_INSTALL = YES; 510 | SWIFT_VERSION = 4.2; 511 | TARGETED_DEVICE_FAMILY = "1,2"; 512 | }; 513 | name = Release; 514 | }; 515 | /* End XCBuildConfiguration section */ 516 | 517 | /* Begin XCConfigurationList section */ 518 | 9518381A21E4F00200BEA6EB /* Build configuration list for PBXNativeTarget "CarLensCollectionViewLayoutDemo" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | 9518381B21E4F00200BEA6EB /* Debug */, 522 | 9518381C21E4F00200BEA6EB /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | defaultConfigurationName = Release; 526 | }; 527 | 955E4FC921CBFB2800B4C3BB /* Build configuration list for PBXProject "CarLensCollectionViewLayout" */ = { 528 | isa = XCConfigurationList; 529 | buildConfigurations = ( 530 | 955E4FD521CBFB2800B4C3BB /* Debug */, 531 | 955E4FD621CBFB2800B4C3BB /* Release */, 532 | ); 533 | defaultConfigurationIsVisible = 0; 534 | defaultConfigurationName = Release; 535 | }; 536 | 955E4FD721CBFB2800B4C3BB /* Build configuration list for PBXNativeTarget "CarLensCollectionViewLayout" */ = { 537 | isa = XCConfigurationList; 538 | buildConfigurations = ( 539 | 955E4FD821CBFB2800B4C3BB /* Debug */, 540 | 955E4FD921CBFB2800B4C3BB /* Release */, 541 | ); 542 | defaultConfigurationIsVisible = 0; 543 | defaultConfigurationName = Release; 544 | }; 545 | /* End XCConfigurationList section */ 546 | }; 547 | rootObject = 955E4FC621CBFB2800B4C3BB /* Project object */; 548 | } 549 | --------------------------------------------------------------------------------