├── .gitignore
├── LICENSE
├── README.md
├── UPCarouselFlowLayout.podspec
├── UPCarouselFlowLayout
├── Info.plist
├── UPCarouselFlowLayout.h
└── UPCarouselFlowLayout.swift
├── UPCarouselFlowLayoutDemo.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── xcshareddata
│ └── xcschemes
│ └── UPCarouselFlowLayout.xcscheme
├── UPCarouselFlowLayoutDemo
├── AppDelegate.swift
├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── brave.imageset
│ │ ├── Contents.json
│ │ └── brave.png
│ ├── buzz.imageset
│ │ ├── Contents.json
│ │ └── buzz.png
│ ├── monsters.imageset
│ │ ├── Contents.json
│ │ └── monsters.png
│ ├── nemo.imageset
│ │ ├── Contents.json
│ │ └── nemo.png
│ ├── ratatouille.imageset
│ │ ├── Contents.json
│ │ └── ratatouille.png
│ └── wall-e.imageset
│ │ ├── Contents.json
│ │ └── wall-e.png
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── CarouselCollectionViewCell.swift
├── Character.swift
├── GradientView.swift
├── Info.plist
└── ViewController.swift
└── images
├── demo.gif
└── ib_settings.png
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xcuserstate
23 |
24 | ## Obj-C/Swift specific
25 | *.hmap
26 | *.ipa
27 | *.dSYM.zip
28 | *.dSYM
29 |
30 | ## Playgrounds
31 | timeline.xctimeline
32 | playground.xcworkspace
33 |
34 | # Swift Package Manager
35 | #
36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
37 | # Packages/
38 | .build/
39 |
40 | # CocoaPods
41 | #
42 | # We recommend against adding the Pods directory to your .gitignore. However
43 | # you should judge for yourself, the pros and cons are mentioned at:
44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
45 | #
46 | # Pods/
47 |
48 | # Carthage
49 | #
50 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
51 | # Carthage/Checkouts
52 |
53 | Carthage/Build
54 |
55 | # fastlane
56 | #
57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
58 | # screenshots whenever they are needed.
59 | # For more information about the recommended setup visit:
60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
61 |
62 | fastlane/report.xml
63 | fastlane/Preview.html
64 | fastlane/screenshots
65 | fastlane/test_output
66 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Paul Ulric
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | UPCarouselFlowLayout
2 | ===============
3 |
4 | `UPCarouselFlowLayout` is a fancy carousel flow layout for `UICollectionView`. It comes with a paginated effect and it shrinks and makes transparent the side items.
5 |
6 | 
7 |
8 | ## Requirements
9 |
10 | - iOS 8.1+
11 |
12 | ## Installation
13 |
14 | ### CocoaPods
15 |
16 | `UPCarouselFlowLayout` is available through [CocoaPods](http://cocoapods.org). To install
17 | it, simply add the following line to your Podfile:
18 |
19 | ```
20 | pod "UPCarouselFlowLayout"
21 | ```
22 |
23 | ### Carthage
24 |
25 | Users can simply add to their Cartfile:
26 |
27 | ```
28 | github "ink-spot/UPCarouselFlowLayout"
29 | ```
30 |
31 | ### Manual
32 |
33 | Simply copy the folder `UPCarouselFlowLayout` to your project and import it in XCode.
34 |
35 | ## Usage
36 |
37 | ### Getting Started
38 |
39 | ##### Via code
40 |
41 | ```swift
42 | import UPCarouselFlowLayout
43 | ```
44 |
45 | Create a `UPCarouselFlowLayout` object, set its `itemSize` and assign it to your `UICollectionView`.
46 |
47 | ```swift
48 | let layout = UPCarouselFlowLayout()
49 | layout.itemSize = CGSizeMake(200, 200)
50 | collectionView.collectionViewLayout = layout
51 | ```
52 |
53 | ##### Via Interface Builder
54 |
55 | Set the `UICollectionView` layout class to `UPCarouselFlowLayout`, and set its `itemSize` and its properties.
56 |
57 | 
58 |
59 | ### Properties
60 |
61 | `UPCarouselFlowLayout` has a few customizable properties:
62 |
63 | * `sideItemScale` (between 0 and 1, default is 0.6)
64 | *Can be set through code or via Interface Builder.*
65 | The shrinking ratio for collection items which are not in the center.
66 |
67 | * `sideItemAlpha` (between 0 and 1, default is 0.6)
68 | *Can be set through code or via Interface Builder.*
69 | The opacity ratio for collection items which are not in the center.
70 |
71 | * `sideItemShift` (value in pixels, default is 0)
72 | *Can be set through code or via Interface Builder.*
73 | A vertical/horizontal offset (depending on the collectionView scroll direction) for collection items which are not in the center.
74 |
75 | * `spacingMode` (default is fixed spacing of 40 pts)
76 | *Can be set only through code.*
77 | * `UPCarouselFlowLayoutSpacingMode.fixed(spacing: CGFloat)`
78 | Items in the carousel are positioned with a fixed space between them.
79 | * `UPCarouselFlowLayoutSpacingMode.overlap(visibleOffset: CGFloat)`
80 | A fixed part of the side items are visible on the sides of the collection (and therefore the space between items depends on the collection size).
81 |
82 |
83 | ## License
84 |
85 | `UPCarouselFlowLayout` is released under the MIT license.
86 | See [LICENSE](./LICENSE) for details.
87 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayout.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "UPCarouselFlowLayout"
3 | s.version = "1.1.2"
4 | s.summary = "A fancy carousel flow layout for UICollectionView."
5 | s.description = "UPCarouselFlowLayout is a fancy carousel flow layout for UICollectionView. It comes with a paginated effect and it shrinks and makes transparent the side items."
6 |
7 | s.homepage = "https://github.com/ink-spot/UPCarouselFlowLayout"
8 | # s.screenshots = "https://github.com/ink-spot/UPCarouselFlowLayout/raw/master/images/demo.gif"
9 | s.license = { :type => 'MIT', :file => 'LICENSE' }
10 | s.author = { 'Paul Ulric' => 'ink.and.spot@gmail.com' }
11 | s.source = { :git => 'https://github.com/ink-spot/UPCarouselFlowLayout.git', :tag => s.version.to_s }
12 |
13 | s.ios.deployment_target = '8.1'
14 | s.swift_version = '4.2'
15 |
16 | s.source_files = 'UPCarouselFlowLayout/**/*.{h,swift}'
17 |
18 | end
19 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayout/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayout/UPCarouselFlowLayout.h:
--------------------------------------------------------------------------------
1 | //
2 | // UPCarouselFlowLayout.h
3 | // UPCarouselFlowLayout
4 | //
5 | // Created by Alex K. on 18/11/16.
6 | // Copyright © 2016 Paul Ulric. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for UPCarouselFlowLayout.
12 | FOUNDATION_EXPORT double UPCarouselFlowLayoutVersionNumber;
13 |
14 | //! Project version string for UPCarouselFlowLayout.
15 | FOUNDATION_EXPORT const unsigned char UPCarouselFlowLayoutVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayout/UPCarouselFlowLayout.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UPCarouselFlowLayout.swift
3 | // UPCarouselFlowLayoutDemo
4 | //
5 | // Created by Paul Ulric on 23/06/2016.
6 | // Copyright © 2016 Paul Ulric. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 |
12 | public enum UPCarouselFlowLayoutSpacingMode {
13 | case fixed(spacing: CGFloat)
14 | case overlap(visibleOffset: CGFloat)
15 | }
16 |
17 |
18 | open class UPCarouselFlowLayout: UICollectionViewFlowLayout {
19 |
20 | fileprivate struct LayoutState {
21 | var size: CGSize
22 | var direction: UICollectionView.ScrollDirection
23 | func isEqual(_ otherState: LayoutState) -> Bool {
24 | return self.size.equalTo(otherState.size) && self.direction == otherState.direction
25 | }
26 | }
27 |
28 | @IBInspectable open var sideItemScale: CGFloat = 0.6
29 | @IBInspectable open var sideItemAlpha: CGFloat = 0.6
30 | @IBInspectable open var sideItemShift: CGFloat = 0.0
31 | open var spacingMode = UPCarouselFlowLayoutSpacingMode.fixed(spacing: 40)
32 |
33 | fileprivate var state = LayoutState(size: CGSize.zero, direction: .horizontal)
34 |
35 |
36 | override open func prepare() {
37 | super.prepare()
38 | let currentState = LayoutState(size: self.collectionView!.bounds.size, direction: self.scrollDirection)
39 |
40 | if !self.state.isEqual(currentState) {
41 | self.setupCollectionView()
42 | self.updateLayout()
43 | self.state = currentState
44 | }
45 | }
46 |
47 | fileprivate func setupCollectionView() {
48 | guard let collectionView = self.collectionView else { return }
49 | if collectionView.decelerationRate != UIScrollView.DecelerationRate.fast {
50 | collectionView.decelerationRate = UIScrollView.DecelerationRate.fast
51 | }
52 | }
53 |
54 | fileprivate func updateLayout() {
55 | guard let collectionView = self.collectionView else { return }
56 |
57 | let collectionSize = collectionView.bounds.size
58 | let isHorizontal = (self.scrollDirection == .horizontal)
59 |
60 | let yInset = (collectionSize.height - self.itemSize.height) / 2
61 | let xInset = (collectionSize.width - self.itemSize.width) / 2
62 | self.sectionInset = UIEdgeInsets.init(top: yInset, left: xInset, bottom: yInset, right: xInset)
63 |
64 | let side = isHorizontal ? self.itemSize.width : self.itemSize.height
65 | let scaledItemOffset = (side - side*self.sideItemScale) / 2
66 | switch self.spacingMode {
67 | case .fixed(let spacing):
68 | self.minimumLineSpacing = spacing - scaledItemOffset
69 | case .overlap(let visibleOffset):
70 | let fullSizeSideItemOverlap = visibleOffset + scaledItemOffset
71 | let inset = isHorizontal ? xInset : yInset
72 | self.minimumLineSpacing = inset - fullSizeSideItemOverlap
73 | }
74 | }
75 |
76 | override open func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
77 | return true
78 | }
79 |
80 | override open func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
81 | guard let superAttributes = super.layoutAttributesForElements(in: rect),
82 | let attributes = NSArray(array: superAttributes, copyItems: true) as? [UICollectionViewLayoutAttributes]
83 | else { return nil }
84 | return attributes.map({ self.transformLayoutAttributes($0) })
85 | }
86 |
87 | fileprivate func transformLayoutAttributes(_ attributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
88 | guard let collectionView = self.collectionView else { return attributes }
89 | let isHorizontal = (self.scrollDirection == .horizontal)
90 |
91 | let collectionCenter = isHorizontal ? collectionView.frame.size.width/2 : collectionView.frame.size.height/2
92 | let offset = isHorizontal ? collectionView.contentOffset.x : collectionView.contentOffset.y
93 | let normalizedCenter = (isHorizontal ? attributes.center.x : attributes.center.y) - offset
94 |
95 | let maxDistance = (isHorizontal ? self.itemSize.width : self.itemSize.height) + self.minimumLineSpacing
96 | let distance = min(abs(collectionCenter - normalizedCenter), maxDistance)
97 | let ratio = (maxDistance - distance)/maxDistance
98 |
99 | let alpha = ratio * (1 - self.sideItemAlpha) + self.sideItemAlpha
100 | let scale = ratio * (1 - self.sideItemScale) + self.sideItemScale
101 | let shift = (1 - ratio) * self.sideItemShift
102 | attributes.alpha = alpha
103 | attributes.transform3D = CATransform3DScale(CATransform3DIdentity, scale, scale, 1)
104 | attributes.zIndex = Int(alpha * 10)
105 |
106 | if isHorizontal {
107 | attributes.center.y = attributes.center.y + shift
108 | } else {
109 | attributes.center.x = attributes.center.x + shift
110 | }
111 |
112 | return attributes
113 | }
114 |
115 | override open func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
116 | guard let collectionView = collectionView , !collectionView.isPagingEnabled,
117 | let layoutAttributes = self.layoutAttributesForElements(in: collectionView.bounds)
118 | else { return super.targetContentOffset(forProposedContentOffset: proposedContentOffset) }
119 |
120 | let isHorizontal = (self.scrollDirection == .horizontal)
121 |
122 | let midSide = (isHorizontal ? collectionView.bounds.size.width : collectionView.bounds.size.height) / 2
123 | let proposedContentOffsetCenterOrigin = (isHorizontal ? proposedContentOffset.x : proposedContentOffset.y) + midSide
124 |
125 | var targetContentOffset: CGPoint
126 | if isHorizontal {
127 | let closest = layoutAttributes.sorted { abs($0.center.x - proposedContentOffsetCenterOrigin) < abs($1.center.x - proposedContentOffsetCenterOrigin) }.first ?? UICollectionViewLayoutAttributes()
128 | targetContentOffset = CGPoint(x: floor(closest.center.x - midSide), y: proposedContentOffset.y)
129 | }
130 | else {
131 | let closest = layoutAttributes.sorted { abs($0.center.y - proposedContentOffsetCenterOrigin) < abs($1.center.y - proposedContentOffsetCenterOrigin) }.first ?? UICollectionViewLayoutAttributes()
132 | targetContentOffset = CGPoint(x: proposedContentOffset.x, y: floor(closest.center.y - midSide))
133 | }
134 |
135 | return targetContentOffset
136 | }
137 | }
138 |
139 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 01D387971D229BFC00CE4E1F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D3878B1D229BFC00CE4E1F /* AppDelegate.swift */; };
11 | 01D387981D229BFC00CE4E1F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 01D3878C1D229BFC00CE4E1F /* Assets.xcassets */; };
12 | 01D387991D229BFC00CE4E1F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 01D3878D1D229BFC00CE4E1F /* LaunchScreen.storyboard */; };
13 | 01D3879A1D229BFC00CE4E1F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 01D3878F1D229BFC00CE4E1F /* Main.storyboard */; };
14 | 01D3879B1D229BFC00CE4E1F /* CarouselCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D387911D229BFC00CE4E1F /* CarouselCollectionViewCell.swift */; };
15 | 01D3879C1D229BFC00CE4E1F /* Character.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D387921D229BFC00CE4E1F /* Character.swift */; };
16 | 01D3879D1D229BFC00CE4E1F /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D387931D229BFC00CE4E1F /* GradientView.swift */; };
17 | 01D387A01D229BFC00CE4E1F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D387961D229BFC00CE4E1F /* ViewController.swift */; };
18 | 01D387A31D229E4A00CE4E1F /* UPCarouselFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */; };
19 | 841C95011DDEE57F00B997F5 /* UPCarouselFlowLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 841C94FF1DDEE57F00B997F5 /* UPCarouselFlowLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
20 | 841C95041DDEE57F00B997F5 /* UPCarouselFlowLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 841C94FD1DDEE57F00B997F5 /* UPCarouselFlowLayout.framework */; };
21 | 841C95051DDEE57F00B997F5 /* UPCarouselFlowLayout.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 841C94FD1DDEE57F00B997F5 /* UPCarouselFlowLayout.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
22 | 841C950A1DDEE5A100B997F5 /* UPCarouselFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXContainerItemProxy section */
26 | 841C95021DDEE57F00B997F5 /* PBXContainerItemProxy */ = {
27 | isa = PBXContainerItemProxy;
28 | containerPortal = 01D387631D1C4B9D00CE4E1F /* Project object */;
29 | proxyType = 1;
30 | remoteGlobalIDString = 841C94FC1DDEE57F00B997F5;
31 | remoteInfo = UPCarouselFlowLayout;
32 | };
33 | /* End PBXContainerItemProxy section */
34 |
35 | /* Begin PBXCopyFilesBuildPhase section */
36 | 841C95091DDEE57F00B997F5 /* Embed Frameworks */ = {
37 | isa = PBXCopyFilesBuildPhase;
38 | buildActionMask = 2147483647;
39 | dstPath = "";
40 | dstSubfolderSpec = 10;
41 | files = (
42 | 841C95051DDEE57F00B997F5 /* UPCarouselFlowLayout.framework in Embed Frameworks */,
43 | );
44 | name = "Embed Frameworks";
45 | runOnlyForDeploymentPostprocessing = 0;
46 | };
47 | /* End PBXCopyFilesBuildPhase section */
48 |
49 | /* Begin PBXFileReference section */
50 | 01D3876B1D1C4B9D00CE4E1F /* UPCarouselFlowLayoutDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UPCarouselFlowLayoutDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 01D3878B1D229BFC00CE4E1F /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
52 | 01D3878C1D229BFC00CE4E1F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
53 | 01D3878E1D229BFC00CE4E1F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
54 | 01D387901D229BFC00CE4E1F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
55 | 01D387911D229BFC00CE4E1F /* CarouselCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CarouselCollectionViewCell.swift; sourceTree = ""; };
56 | 01D387921D229BFC00CE4E1F /* Character.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Character.swift; sourceTree = ""; };
57 | 01D387931D229BFC00CE4E1F /* GradientView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientView.swift; sourceTree = ""; };
58 | 01D387941D229BFC00CE4E1F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
59 | 01D387961D229BFC00CE4E1F /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
60 | 01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UPCarouselFlowLayout.swift; sourceTree = ""; };
61 | 841C94F01DDEE4E300B997F5 /* UPCarouselFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UPCarouselFlowLayout.h; sourceTree = ""; };
62 | 841C94F11DDEE4E300B997F5 /* UPCarouselFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UPCarouselFlowLayout.m; sourceTree = ""; };
63 | 841C94FD1DDEE57F00B997F5 /* UPCarouselFlowLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = UPCarouselFlowLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; };
64 | 841C94FF1DDEE57F00B997F5 /* UPCarouselFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UPCarouselFlowLayout.h; sourceTree = ""; };
65 | 841C95001DDEE57F00B997F5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
66 | /* End PBXFileReference section */
67 |
68 | /* Begin PBXFrameworksBuildPhase section */
69 | 01D387681D1C4B9D00CE4E1F /* Frameworks */ = {
70 | isa = PBXFrameworksBuildPhase;
71 | buildActionMask = 2147483647;
72 | files = (
73 | 841C95041DDEE57F00B997F5 /* UPCarouselFlowLayout.framework in Frameworks */,
74 | );
75 | runOnlyForDeploymentPostprocessing = 0;
76 | };
77 | 841C94F91DDEE57F00B997F5 /* Frameworks */ = {
78 | isa = PBXFrameworksBuildPhase;
79 | buildActionMask = 2147483647;
80 | files = (
81 | );
82 | runOnlyForDeploymentPostprocessing = 0;
83 | };
84 | /* End PBXFrameworksBuildPhase section */
85 |
86 | /* Begin PBXGroup section */
87 | 01D387621D1C4B9D00CE4E1F = {
88 | isa = PBXGroup;
89 | children = (
90 | 01D3878A1D229BFC00CE4E1F /* UPCarouselFlowLayoutDemo */,
91 | 841C94EF1DDEE4E300B997F5 /* UPCarouselFlowLayout */,
92 | 841C94FE1DDEE57F00B997F5 /* UPCarouselFlowLayout */,
93 | 01D3876C1D1C4B9D00CE4E1F /* Products */,
94 | );
95 | sourceTree = "";
96 | };
97 | 01D3876C1D1C4B9D00CE4E1F /* Products */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 01D3876B1D1C4B9D00CE4E1F /* UPCarouselFlowLayoutDemo.app */,
101 | 841C94FD1DDEE57F00B997F5 /* UPCarouselFlowLayout.framework */,
102 | );
103 | name = Products;
104 | sourceTree = "";
105 | };
106 | 01D3878A1D229BFC00CE4E1F /* UPCarouselFlowLayoutDemo */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 01D387A11D229E4A00CE4E1F /* UPCarouselFlowLayout */,
110 | 01D3878B1D229BFC00CE4E1F /* AppDelegate.swift */,
111 | 01D387931D229BFC00CE4E1F /* GradientView.swift */,
112 | 01D387961D229BFC00CE4E1F /* ViewController.swift */,
113 | 01D387921D229BFC00CE4E1F /* Character.swift */,
114 | 01D387911D229BFC00CE4E1F /* CarouselCollectionViewCell.swift */,
115 | 01D3878C1D229BFC00CE4E1F /* Assets.xcassets */,
116 | 01D3878D1D229BFC00CE4E1F /* LaunchScreen.storyboard */,
117 | 01D3878F1D229BFC00CE4E1F /* Main.storyboard */,
118 | 01D387941D229BFC00CE4E1F /* Info.plist */,
119 | );
120 | path = UPCarouselFlowLayoutDemo;
121 | sourceTree = "";
122 | };
123 | 01D387A11D229E4A00CE4E1F /* UPCarouselFlowLayout */ = {
124 | isa = PBXGroup;
125 | children = (
126 | 01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */,
127 | );
128 | path = UPCarouselFlowLayout;
129 | sourceTree = SOURCE_ROOT;
130 | };
131 | 841C94EF1DDEE4E300B997F5 /* UPCarouselFlowLayout */ = {
132 | isa = PBXGroup;
133 | children = (
134 | 841C94F01DDEE4E300B997F5 /* UPCarouselFlowLayout.h */,
135 | 841C94F11DDEE4E300B997F5 /* UPCarouselFlowLayout.m */,
136 | );
137 | path = UPCarouselFlowLayout;
138 | sourceTree = "";
139 | };
140 | 841C94FE1DDEE57F00B997F5 /* UPCarouselFlowLayout */ = {
141 | isa = PBXGroup;
142 | children = (
143 | 841C94FF1DDEE57F00B997F5 /* UPCarouselFlowLayout.h */,
144 | 841C95001DDEE57F00B997F5 /* Info.plist */,
145 | );
146 | path = UPCarouselFlowLayout;
147 | sourceTree = "";
148 | };
149 | /* End PBXGroup section */
150 |
151 | /* Begin PBXHeadersBuildPhase section */
152 | 841C94FA1DDEE57F00B997F5 /* Headers */ = {
153 | isa = PBXHeadersBuildPhase;
154 | buildActionMask = 2147483647;
155 | files = (
156 | 841C95011DDEE57F00B997F5 /* UPCarouselFlowLayout.h in Headers */,
157 | );
158 | runOnlyForDeploymentPostprocessing = 0;
159 | };
160 | /* End PBXHeadersBuildPhase section */
161 |
162 | /* Begin PBXNativeTarget section */
163 | 01D3876A1D1C4B9D00CE4E1F /* UPCarouselFlowLayoutDemo */ = {
164 | isa = PBXNativeTarget;
165 | buildConfigurationList = 01D3877D1D1C4B9D00CE4E1F /* Build configuration list for PBXNativeTarget "UPCarouselFlowLayoutDemo" */;
166 | buildPhases = (
167 | 01D387671D1C4B9D00CE4E1F /* Sources */,
168 | 01D387681D1C4B9D00CE4E1F /* Frameworks */,
169 | 01D387691D1C4B9D00CE4E1F /* Resources */,
170 | 841C95091DDEE57F00B997F5 /* Embed Frameworks */,
171 | );
172 | buildRules = (
173 | );
174 | dependencies = (
175 | 841C95031DDEE57F00B997F5 /* PBXTargetDependency */,
176 | );
177 | name = UPCarouselFlowLayoutDemo;
178 | productName = UPCardCollectionViewLayoutDemo;
179 | productReference = 01D3876B1D1C4B9D00CE4E1F /* UPCarouselFlowLayoutDemo.app */;
180 | productType = "com.apple.product-type.application";
181 | };
182 | 841C94FC1DDEE57F00B997F5 /* UPCarouselFlowLayout */ = {
183 | isa = PBXNativeTarget;
184 | buildConfigurationList = 841C95061DDEE57F00B997F5 /* Build configuration list for PBXNativeTarget "UPCarouselFlowLayout" */;
185 | buildPhases = (
186 | 841C94F81DDEE57F00B997F5 /* Sources */,
187 | 841C94F91DDEE57F00B997F5 /* Frameworks */,
188 | 841C94FA1DDEE57F00B997F5 /* Headers */,
189 | 841C94FB1DDEE57F00B997F5 /* Resources */,
190 | );
191 | buildRules = (
192 | );
193 | dependencies = (
194 | );
195 | name = UPCarouselFlowLayout;
196 | productName = UPCarouselFlowLayout;
197 | productReference = 841C94FD1DDEE57F00B997F5 /* UPCarouselFlowLayout.framework */;
198 | productType = "com.apple.product-type.framework";
199 | };
200 | /* End PBXNativeTarget section */
201 |
202 | /* Begin PBXProject section */
203 | 01D387631D1C4B9D00CE4E1F /* Project object */ = {
204 | isa = PBXProject;
205 | attributes = {
206 | LastSwiftUpdateCheck = 0730;
207 | LastUpgradeCheck = 1000;
208 | ORGANIZATIONNAME = "Paul Ulric";
209 | TargetAttributes = {
210 | 01D3876A1D1C4B9D00CE4E1F = {
211 | CreatedOnToolsVersion = 7.3.1;
212 | LastSwiftMigration = 1000;
213 | };
214 | 841C94FC1DDEE57F00B997F5 = {
215 | CreatedOnToolsVersion = 8.1;
216 | LastSwiftMigration = 1000;
217 | ProvisioningStyle = Automatic;
218 | };
219 | };
220 | };
221 | buildConfigurationList = 01D387661D1C4B9D00CE4E1F /* Build configuration list for PBXProject "UPCarouselFlowLayoutDemo" */;
222 | compatibilityVersion = "Xcode 3.2";
223 | developmentRegion = English;
224 | hasScannedForEncodings = 0;
225 | knownRegions = (
226 | en,
227 | Base,
228 | );
229 | mainGroup = 01D387621D1C4B9D00CE4E1F;
230 | productRefGroup = 01D3876C1D1C4B9D00CE4E1F /* Products */;
231 | projectDirPath = "";
232 | projectRoot = "";
233 | targets = (
234 | 01D3876A1D1C4B9D00CE4E1F /* UPCarouselFlowLayoutDemo */,
235 | 841C94FC1DDEE57F00B997F5 /* UPCarouselFlowLayout */,
236 | );
237 | };
238 | /* End PBXProject section */
239 |
240 | /* Begin PBXResourcesBuildPhase section */
241 | 01D387691D1C4B9D00CE4E1F /* Resources */ = {
242 | isa = PBXResourcesBuildPhase;
243 | buildActionMask = 2147483647;
244 | files = (
245 | 01D387981D229BFC00CE4E1F /* Assets.xcassets in Resources */,
246 | 01D3879A1D229BFC00CE4E1F /* Main.storyboard in Resources */,
247 | 01D387991D229BFC00CE4E1F /* LaunchScreen.storyboard in Resources */,
248 | );
249 | runOnlyForDeploymentPostprocessing = 0;
250 | };
251 | 841C94FB1DDEE57F00B997F5 /* Resources */ = {
252 | isa = PBXResourcesBuildPhase;
253 | buildActionMask = 2147483647;
254 | files = (
255 | );
256 | runOnlyForDeploymentPostprocessing = 0;
257 | };
258 | /* End PBXResourcesBuildPhase section */
259 |
260 | /* Begin PBXSourcesBuildPhase section */
261 | 01D387671D1C4B9D00CE4E1F /* Sources */ = {
262 | isa = PBXSourcesBuildPhase;
263 | buildActionMask = 2147483647;
264 | files = (
265 | 01D3879C1D229BFC00CE4E1F /* Character.swift in Sources */,
266 | 01D3879B1D229BFC00CE4E1F /* CarouselCollectionViewCell.swift in Sources */,
267 | 01D387A31D229E4A00CE4E1F /* UPCarouselFlowLayout.swift in Sources */,
268 | 01D3879D1D229BFC00CE4E1F /* GradientView.swift in Sources */,
269 | 01D387A01D229BFC00CE4E1F /* ViewController.swift in Sources */,
270 | 01D387971D229BFC00CE4E1F /* AppDelegate.swift in Sources */,
271 | );
272 | runOnlyForDeploymentPostprocessing = 0;
273 | };
274 | 841C94F81DDEE57F00B997F5 /* Sources */ = {
275 | isa = PBXSourcesBuildPhase;
276 | buildActionMask = 2147483647;
277 | files = (
278 | 841C950A1DDEE5A100B997F5 /* UPCarouselFlowLayout.swift in Sources */,
279 | );
280 | runOnlyForDeploymentPostprocessing = 0;
281 | };
282 | /* End PBXSourcesBuildPhase section */
283 |
284 | /* Begin PBXTargetDependency section */
285 | 841C95031DDEE57F00B997F5 /* PBXTargetDependency */ = {
286 | isa = PBXTargetDependency;
287 | target = 841C94FC1DDEE57F00B997F5 /* UPCarouselFlowLayout */;
288 | targetProxy = 841C95021DDEE57F00B997F5 /* PBXContainerItemProxy */;
289 | };
290 | /* End PBXTargetDependency section */
291 |
292 | /* Begin PBXVariantGroup section */
293 | 01D3878D1D229BFC00CE4E1F /* LaunchScreen.storyboard */ = {
294 | isa = PBXVariantGroup;
295 | children = (
296 | 01D3878E1D229BFC00CE4E1F /* Base */,
297 | );
298 | name = LaunchScreen.storyboard;
299 | sourceTree = "";
300 | };
301 | 01D3878F1D229BFC00CE4E1F /* Main.storyboard */ = {
302 | isa = PBXVariantGroup;
303 | children = (
304 | 01D387901D229BFC00CE4E1F /* Base */,
305 | );
306 | name = Main.storyboard;
307 | sourceTree = "";
308 | };
309 | /* End PBXVariantGroup section */
310 |
311 | /* Begin XCBuildConfiguration section */
312 | 01D3877B1D1C4B9D00CE4E1F /* Debug */ = {
313 | isa = XCBuildConfiguration;
314 | buildSettings = {
315 | ALWAYS_SEARCH_USER_PATHS = NO;
316 | CLANG_ANALYZER_NONNULL = YES;
317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
318 | CLANG_CXX_LIBRARY = "libc++";
319 | CLANG_ENABLE_MODULES = YES;
320 | CLANG_ENABLE_OBJC_ARC = YES;
321 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
322 | CLANG_WARN_BOOL_CONVERSION = YES;
323 | CLANG_WARN_COMMA = YES;
324 | CLANG_WARN_CONSTANT_CONVERSION = YES;
325 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
327 | CLANG_WARN_EMPTY_BODY = YES;
328 | CLANG_WARN_ENUM_CONVERSION = YES;
329 | CLANG_WARN_INFINITE_RECURSION = YES;
330 | CLANG_WARN_INT_CONVERSION = YES;
331 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
332 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
333 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
334 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
335 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
336 | CLANG_WARN_STRICT_PROTOTYPES = YES;
337 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
338 | CLANG_WARN_UNREACHABLE_CODE = YES;
339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
340 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
341 | COPY_PHASE_STRIP = NO;
342 | DEBUG_INFORMATION_FORMAT = dwarf;
343 | ENABLE_STRICT_OBJC_MSGSEND = YES;
344 | ENABLE_TESTABILITY = YES;
345 | GCC_C_LANGUAGE_STANDARD = gnu99;
346 | GCC_DYNAMIC_NO_PIC = NO;
347 | GCC_NO_COMMON_BLOCKS = YES;
348 | GCC_OPTIMIZATION_LEVEL = 0;
349 | GCC_PREPROCESSOR_DEFINITIONS = (
350 | "DEBUG=1",
351 | "$(inherited)",
352 | );
353 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
354 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
355 | GCC_WARN_UNDECLARED_SELECTOR = YES;
356 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
357 | GCC_WARN_UNUSED_FUNCTION = YES;
358 | GCC_WARN_UNUSED_VARIABLE = YES;
359 | IPHONEOS_DEPLOYMENT_TARGET = 10.1;
360 | MTL_ENABLE_DEBUG_INFO = YES;
361 | ONLY_ACTIVE_ARCH = YES;
362 | SDKROOT = iphoneos;
363 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
364 | };
365 | name = Debug;
366 | };
367 | 01D3877C1D1C4B9D00CE4E1F /* Release */ = {
368 | isa = XCBuildConfiguration;
369 | buildSettings = {
370 | ALWAYS_SEARCH_USER_PATHS = NO;
371 | CLANG_ANALYZER_NONNULL = YES;
372 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
373 | CLANG_CXX_LIBRARY = "libc++";
374 | CLANG_ENABLE_MODULES = YES;
375 | CLANG_ENABLE_OBJC_ARC = YES;
376 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
377 | CLANG_WARN_BOOL_CONVERSION = YES;
378 | CLANG_WARN_COMMA = YES;
379 | CLANG_WARN_CONSTANT_CONVERSION = YES;
380 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
381 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
382 | CLANG_WARN_EMPTY_BODY = YES;
383 | CLANG_WARN_ENUM_CONVERSION = YES;
384 | CLANG_WARN_INFINITE_RECURSION = YES;
385 | CLANG_WARN_INT_CONVERSION = YES;
386 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
387 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
388 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
389 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
390 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
391 | CLANG_WARN_STRICT_PROTOTYPES = YES;
392 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
393 | CLANG_WARN_UNREACHABLE_CODE = YES;
394 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
395 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
396 | COPY_PHASE_STRIP = NO;
397 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
398 | ENABLE_NS_ASSERTIONS = NO;
399 | ENABLE_STRICT_OBJC_MSGSEND = YES;
400 | GCC_C_LANGUAGE_STANDARD = gnu99;
401 | GCC_NO_COMMON_BLOCKS = YES;
402 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
403 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
404 | GCC_WARN_UNDECLARED_SELECTOR = YES;
405 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
406 | GCC_WARN_UNUSED_FUNCTION = YES;
407 | GCC_WARN_UNUSED_VARIABLE = YES;
408 | IPHONEOS_DEPLOYMENT_TARGET = 10.1;
409 | MTL_ENABLE_DEBUG_INFO = NO;
410 | SDKROOT = iphoneos;
411 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
412 | VALIDATE_PRODUCT = YES;
413 | };
414 | name = Release;
415 | };
416 | 01D3877E1D1C4B9D00CE4E1F /* Debug */ = {
417 | isa = XCBuildConfiguration;
418 | buildSettings = {
419 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
421 | DEVELOPMENT_TEAM = "";
422 | INFOPLIST_FILE = UPCarouselFlowLayoutDemo/Info.plist;
423 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
424 | PRODUCT_BUNDLE_IDENTIFIER = UP.UPCarouselFlowLayoutDemo;
425 | PRODUCT_NAME = UPCarouselFlowLayoutDemo;
426 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
427 | SWIFT_VERSION = 4.2;
428 | };
429 | name = Debug;
430 | };
431 | 01D3877F1D1C4B9D00CE4E1F /* Release */ = {
432 | isa = XCBuildConfiguration;
433 | buildSettings = {
434 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
435 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
436 | DEVELOPMENT_TEAM = "";
437 | INFOPLIST_FILE = UPCarouselFlowLayoutDemo/Info.plist;
438 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
439 | PRODUCT_BUNDLE_IDENTIFIER = UP.UPCarouselFlowLayoutDemo;
440 | PRODUCT_NAME = UPCarouselFlowLayoutDemo;
441 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
442 | SWIFT_VERSION = 4.2;
443 | };
444 | name = Release;
445 | };
446 | 841C95071DDEE57F00B997F5 /* Debug */ = {
447 | isa = XCBuildConfiguration;
448 | buildSettings = {
449 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
450 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
451 | CODE_SIGN_IDENTITY = "";
452 | CURRENT_PROJECT_VERSION = 1;
453 | DEFINES_MODULE = YES;
454 | DYLIB_COMPATIBILITY_VERSION = 1;
455 | DYLIB_CURRENT_VERSION = 1;
456 | DYLIB_INSTALL_NAME_BASE = "@rpath";
457 | INFOPLIST_FILE = UPCarouselFlowLayout/Info.plist;
458 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
459 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
460 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
461 | PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.UPCarouselFlowLayout;
462 | PRODUCT_NAME = "$(TARGET_NAME)";
463 | SKIP_INSTALL = YES;
464 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
465 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
466 | SWIFT_VERSION = 4.2;
467 | TARGETED_DEVICE_FAMILY = "1,2";
468 | VERSIONING_SYSTEM = "apple-generic";
469 | VERSION_INFO_PREFIX = "";
470 | };
471 | name = Debug;
472 | };
473 | 841C95081DDEE57F00B997F5 /* Release */ = {
474 | isa = XCBuildConfiguration;
475 | buildSettings = {
476 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
477 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
478 | CODE_SIGN_IDENTITY = "";
479 | CURRENT_PROJECT_VERSION = 1;
480 | DEFINES_MODULE = YES;
481 | DYLIB_COMPATIBILITY_VERSION = 1;
482 | DYLIB_CURRENT_VERSION = 1;
483 | DYLIB_INSTALL_NAME_BASE = "@rpath";
484 | INFOPLIST_FILE = UPCarouselFlowLayout/Info.plist;
485 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
486 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
487 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
488 | PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.UPCarouselFlowLayout;
489 | PRODUCT_NAME = "$(TARGET_NAME)";
490 | SKIP_INSTALL = YES;
491 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
492 | SWIFT_VERSION = 4.2;
493 | TARGETED_DEVICE_FAMILY = "1,2";
494 | VERSIONING_SYSTEM = "apple-generic";
495 | VERSION_INFO_PREFIX = "";
496 | };
497 | name = Release;
498 | };
499 | /* End XCBuildConfiguration section */
500 |
501 | /* Begin XCConfigurationList section */
502 | 01D387661D1C4B9D00CE4E1F /* Build configuration list for PBXProject "UPCarouselFlowLayoutDemo" */ = {
503 | isa = XCConfigurationList;
504 | buildConfigurations = (
505 | 01D3877B1D1C4B9D00CE4E1F /* Debug */,
506 | 01D3877C1D1C4B9D00CE4E1F /* Release */,
507 | );
508 | defaultConfigurationIsVisible = 0;
509 | defaultConfigurationName = Release;
510 | };
511 | 01D3877D1D1C4B9D00CE4E1F /* Build configuration list for PBXNativeTarget "UPCarouselFlowLayoutDemo" */ = {
512 | isa = XCConfigurationList;
513 | buildConfigurations = (
514 | 01D3877E1D1C4B9D00CE4E1F /* Debug */,
515 | 01D3877F1D1C4B9D00CE4E1F /* Release */,
516 | );
517 | defaultConfigurationIsVisible = 0;
518 | defaultConfigurationName = Release;
519 | };
520 | 841C95061DDEE57F00B997F5 /* Build configuration list for PBXNativeTarget "UPCarouselFlowLayout" */ = {
521 | isa = XCConfigurationList;
522 | buildConfigurations = (
523 | 841C95071DDEE57F00B997F5 /* Debug */,
524 | 841C95081DDEE57F00B997F5 /* Release */,
525 | );
526 | defaultConfigurationIsVisible = 0;
527 | defaultConfigurationName = Release;
528 | };
529 | /* End XCConfigurationList section */
530 | };
531 | rootObject = 01D387631D1C4B9D00CE4E1F /* Project object */;
532 | }
533 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo.xcodeproj/xcshareddata/xcschemes/UPCarouselFlowLayout.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 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // UPCarouselFlowLayoutDemo
4 | //
5 | // Created by Paul Ulric on 23/06/2016.
6 | // Copyright © 2016 Paul Ulric. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/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 | "info" : {
45 | "version" : 1,
46 | "author" : "xcode"
47 | }
48 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/brave.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "brave.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/brave.imageset/brave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zepojo/UPCarouselFlowLayout/b1a363190ed9dbeacbfd15db7cea6c47c919d433/UPCarouselFlowLayoutDemo/Assets.xcassets/brave.imageset/brave.png
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/buzz.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "buzz.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/buzz.imageset/buzz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zepojo/UPCarouselFlowLayout/b1a363190ed9dbeacbfd15db7cea6c47c919d433/UPCarouselFlowLayoutDemo/Assets.xcassets/buzz.imageset/buzz.png
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/monsters.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "monsters.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/monsters.imageset/monsters.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zepojo/UPCarouselFlowLayout/b1a363190ed9dbeacbfd15db7cea6c47c919d433/UPCarouselFlowLayoutDemo/Assets.xcassets/monsters.imageset/monsters.png
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/nemo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "nemo.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/nemo.imageset/nemo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zepojo/UPCarouselFlowLayout/b1a363190ed9dbeacbfd15db7cea6c47c919d433/UPCarouselFlowLayoutDemo/Assets.xcassets/nemo.imageset/nemo.png
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/ratatouille.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "ratatouille.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/ratatouille.imageset/ratatouille.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zepojo/UPCarouselFlowLayout/b1a363190ed9dbeacbfd15db7cea6c47c919d433/UPCarouselFlowLayoutDemo/Assets.xcassets/ratatouille.imageset/ratatouille.png
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/wall-e.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "wall-e.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Assets.xcassets/wall-e.imageset/wall-e.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zepojo/UPCarouselFlowLayout/b1a363190ed9dbeacbfd15db7cea6c47c919d433/UPCarouselFlowLayoutDemo/Assets.xcassets/wall-e.imageset/wall-e.png
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
92 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/CarouselCollectionViewCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CarouselCollectionViewCell.swift
3 | // UPCarouselFlowLayoutDemo
4 | //
5 | // Created by Paul Ulric on 23/06/2016.
6 | // Copyright © 2016 Paul Ulric. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class CarouselCollectionViewCell: UICollectionViewCell {
12 | @IBOutlet weak var image: UIImageView!
13 | static let identifier = "CarouselCollectionViewCell"
14 |
15 | required init?(coder aDecoder: NSCoder) {
16 | super.init(coder: aDecoder)
17 |
18 | self.layer.cornerRadius = max(self.frame.size.width, self.frame.size.height) / 2
19 | self.layer.borderWidth = 10
20 | self.layer.borderColor = UIColor(red: 110.0/255.0, green: 80.0/255.0, blue: 140.0/255.0, alpha: 1.0).cgColor
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Character.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Character.swift
3 | // UPCarouselFlowLayoutDemo
4 | //
5 | // Created by Paul Ulric on 28/06/2016.
6 | // Copyright © 2016 Paul Ulric. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | struct Character {
12 | let imageName: String!
13 | let name: String!
14 | let movie: String!
15 | }
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/GradientView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GradientView.swift
3 | // UPCarouselFlowLayoutDemo
4 | //
5 | // Created by Paul Ulric on 28/06/2016.
6 | // Copyright © 2016 Paul Ulric. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class GradientView: UIView {
12 |
13 | override func draw(_ rect: CGRect) {
14 | let colorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB()
15 | let context: CGContext = UIGraphicsGetCurrentContext()!
16 | context.saveGState()
17 |
18 | let startColor: UIColor = UIColor(red: 79.0/255.0, green: 30.0/255.0, blue: 122.0/255.0, alpha: 1.0)
19 | let endColor: UIColor = UIColor(red: 46.0/255.0, green: 12.0/255.0, blue: 80.0/255.0, alpha: 1.0)
20 | let colors = [startColor.cgColor, endColor.cgColor]
21 | let locations: [CGFloat] = [0, 1]
22 | let gradient: CGGradient = CGGradient(colorsSpace: colorSpace, colors: colors as CFArray, locations: locations)!
23 |
24 | let startPoint: CGPoint = CGPoint(x:rect.midX, y: rect.minY)
25 | let endPoint: CGPoint = CGPoint(x: rect.midX, y: rect.maxY)
26 |
27 | context.drawLinearGradient(gradient, start: startPoint, end: endPoint, options: [])
28 | context.restoreGState()
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/UPCarouselFlowLayoutDemo/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // UPCarouselFlowLayoutDemo
4 | //
5 | // Created by Paul Ulric on 23/06/2016.
6 | // Copyright © 2016 Paul Ulric. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
12 |
13 | @IBOutlet weak var infoLabel: UILabel!
14 | @IBOutlet weak var detailLabel: UILabel!
15 | @IBOutlet weak var collectionView: UICollectionView!
16 |
17 | fileprivate var items = [Character]()
18 |
19 | fileprivate var currentPage: Int = 0 {
20 | didSet {
21 | let character = self.items[self.currentPage]
22 | self.infoLabel.text = character.name.uppercased()
23 | self.detailLabel.text = character.movie.uppercased()
24 | }
25 | }
26 |
27 | fileprivate var pageSize: CGSize {
28 | let layout = self.collectionView.collectionViewLayout as! UPCarouselFlowLayout
29 | var pageSize = layout.itemSize
30 | if layout.scrollDirection == .horizontal {
31 | pageSize.width += layout.minimumLineSpacing
32 | } else {
33 | pageSize.height += layout.minimumLineSpacing
34 | }
35 | return pageSize
36 | }
37 |
38 | fileprivate var orientation: UIDeviceOrientation {
39 | return UIDevice.current.orientation
40 | }
41 |
42 |
43 | override func viewDidLoad() {
44 | super.viewDidLoad()
45 |
46 | self.setupLayout()
47 | self.items = self.createItems()
48 |
49 | self.currentPage = 0
50 |
51 | NotificationCenter.default.addObserver(self, selector: #selector(ViewController.rotationDidChange), name: UIDevice.orientationDidChangeNotification, object: nil)
52 | }
53 |
54 | fileprivate func setupLayout() {
55 | let layout = self.collectionView.collectionViewLayout as! UPCarouselFlowLayout
56 | layout.spacingMode = UPCarouselFlowLayoutSpacingMode.overlap(visibleOffset: 30)
57 | }
58 |
59 | fileprivate func createItems() -> [Character] {
60 | let characters = [
61 | Character(imageName: "wall-e", name: "Wall-E", movie: "Wall-E"),
62 | Character(imageName: "nemo", name: "Nemo", movie: "Finding Nemo"),
63 | Character(imageName: "ratatouille", name: "Remy", movie: "Ratatouille"),
64 | Character(imageName: "buzz", name: "Buzz Lightyear", movie: "Toy Story"),
65 | Character(imageName: "monsters", name: "Mike & Sullivan", movie: "Monsters Inc."),
66 | Character(imageName: "brave", name: "Merida", movie: "Brave")
67 | ]
68 | return characters
69 | }
70 |
71 |
72 | @objc fileprivate func rotationDidChange() {
73 | guard !orientation.isFlat else { return }
74 | let layout = self.collectionView.collectionViewLayout as! UPCarouselFlowLayout
75 | let direction: UICollectionView.ScrollDirection = orientation.isPortrait ? .horizontal : .vertical
76 | layout.scrollDirection = direction
77 | if currentPage > 0 {
78 | let indexPath = IndexPath(item: currentPage, section: 0)
79 | let scrollPosition: UICollectionView.ScrollPosition = orientation.isPortrait ? .centeredHorizontally : .centeredVertically
80 | self.collectionView.scrollToItem(at: indexPath, at: scrollPosition, animated: false)
81 | }
82 | }
83 |
84 | // MARK: - Card Collection Delegate & DataSource
85 |
86 | func numberOfSections(in collectionView: UICollectionView) -> Int {
87 | return 1
88 | }
89 |
90 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
91 | return items.count
92 | }
93 |
94 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
95 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CarouselCollectionViewCell.identifier, for: indexPath) as! CarouselCollectionViewCell
96 | let character = items[(indexPath as NSIndexPath).row]
97 | cell.image.image = UIImage(named: character.imageName)
98 | return cell
99 | }
100 |
101 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
102 | let character = items[(indexPath as NSIndexPath).row]
103 | let alert = UIAlertController(title: character.name, message: nil, preferredStyle: .alert)
104 | alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
105 | present(alert, animated: true, completion: nil)
106 | }
107 |
108 |
109 | // MARK: - UIScrollViewDelegate
110 |
111 | func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
112 | let layout = self.collectionView.collectionViewLayout as! UPCarouselFlowLayout
113 | let pageSide = (layout.scrollDirection == .horizontal) ? self.pageSize.width : self.pageSize.height
114 | let offset = (layout.scrollDirection == .horizontal) ? scrollView.contentOffset.x : scrollView.contentOffset.y
115 | currentPage = Int(floor((offset - pageSide / 2) / pageSide) + 1)
116 | }
117 |
118 | }
119 |
120 |
--------------------------------------------------------------------------------
/images/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zepojo/UPCarouselFlowLayout/b1a363190ed9dbeacbfd15db7cea6c47c919d433/images/demo.gif
--------------------------------------------------------------------------------
/images/ib_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zepojo/UPCarouselFlowLayout/b1a363190ed9dbeacbfd15db7cea6c47c919d433/images/ib_settings.png
--------------------------------------------------------------------------------