Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions UPCarouselFlowLayout/UPCarouselFlowLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@

import UIKit


public enum UPCarouselFlowLayoutSpacingMode {
case fixed(spacing: CGFloat)
case overlap(visibleOffset: CGFloat)
}


open class UPCarouselFlowLayout: UICollectionViewFlowLayout {

fileprivate struct LayoutState {
Expand All @@ -32,7 +30,6 @@ open class UPCarouselFlowLayout: UICollectionViewFlowLayout {

fileprivate var state = LayoutState(size: CGSize.zero, direction: .horizontal)


override open func prepare() {
super.prepare()
let currentState = LayoutState(size: self.collectionView!.bounds.size, direction: self.scrollDirection)
Expand Down Expand Up @@ -134,5 +131,8 @@ open class UPCarouselFlowLayout: UICollectionViewFlowLayout {

return targetContentOffset
}

override open var flipsHorizontallyInOppositeLayoutDirection: Bool {
return true
}
}

12 changes: 1 addition & 11 deletions UPCarouselFlowLayoutDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
01D387961D229BFC00CE4E1F /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UPCarouselFlowLayout.swift; sourceTree = "<group>"; };
841C94F01DDEE4E300B997F5 /* UPCarouselFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UPCarouselFlowLayout.h; sourceTree = "<group>"; };
841C94F11DDEE4E300B997F5 /* UPCarouselFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UPCarouselFlowLayout.m; sourceTree = "<group>"; };
841C94FD1DDEE57F00B997F5 /* UPCarouselFlowLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = UPCarouselFlowLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; };
841C94FF1DDEE57F00B997F5 /* UPCarouselFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UPCarouselFlowLayout.h; sourceTree = "<group>"; };
841C95001DDEE57F00B997F5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -106,7 +105,6 @@
01D3878A1D229BFC00CE4E1F /* UPCarouselFlowLayoutDemo */ = {
isa = PBXGroup;
children = (
01D387A11D229E4A00CE4E1F /* UPCarouselFlowLayout */,
01D3878B1D229BFC00CE4E1F /* AppDelegate.swift */,
01D387931D229BFC00CE4E1F /* GradientView.swift */,
01D387961D229BFC00CE4E1F /* ViewController.swift */,
Expand All @@ -120,19 +118,11 @@
path = UPCarouselFlowLayoutDemo;
sourceTree = "<group>";
};
01D387A11D229E4A00CE4E1F /* UPCarouselFlowLayout */ = {
isa = PBXGroup;
children = (
01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */,
);
path = UPCarouselFlowLayout;
sourceTree = SOURCE_ROOT;
};
841C94EF1DDEE4E300B997F5 /* UPCarouselFlowLayout */ = {
isa = PBXGroup;
children = (
841C94F01DDEE4E300B997F5 /* UPCarouselFlowLayout.h */,
841C94F11DDEE4E300B997F5 /* UPCarouselFlowLayout.m */,
01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */,
);
path = UPCarouselFlowLayout;
sourceTree = "<group>";
Expand Down