Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 41ce466ae3 | |||
| c3688a9e1d | |||
| 512885a166 | |||
| 8fad95711e | |||
| d6e792e3ec | |||
| fcea3c29e7 | |||
| 7eb29bd82a | |||
| a64002ef72 | |||
| d3d5136f3d | |||
| 8691a862bc |
@@ -33,3 +33,4 @@ Carthage
|
||||
# Pods/
|
||||
/Example/InfiniteLayout.xcworkspace
|
||||
/Example/Pods
|
||||
/Example/InfiniteLayout.xcodeproj/project.xcworkspace/xcshareddata
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
4.0
|
||||
4.2
|
||||
|
||||
@@ -226,7 +226,6 @@
|
||||
607FACCD1AFB9204008FA782 /* Frameworks */,
|
||||
607FACCE1AFB9204008FA782 /* Resources */,
|
||||
36EEEA4F62F7A41DC7E00F9B /* [CP] Embed Pods Frameworks */,
|
||||
BF7EA699B063C96A45D69BF2 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -245,8 +244,6 @@
|
||||
607FACE11AFB9204008FA782 /* Sources */,
|
||||
607FACE21AFB9204008FA782 /* Frameworks */,
|
||||
607FACE31AFB9204008FA782 /* Resources */,
|
||||
066936A649BBA50B7D22FE7E /* [CP] Embed Pods Frameworks */,
|
||||
56B85F2D241E5ED6DDCED73C /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -321,28 +318,13 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
066936A649BBA50B7D22FE7E /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Tests/Pods-InfiniteLayout_Tests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
36EEEA4F62F7A41DC7E00F9B /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-frameworks.sh",
|
||||
"${PODS_ROOT}/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/CocoaProxy/CocoaProxy.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Differentiator/Differentiator.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/InfiniteLayout/InfiniteLayout.framework",
|
||||
@@ -361,22 +343,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
56B85F2D241E5ED6DDCED73C /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Tests/Pods-InfiniteLayout_Tests-resources.sh\"\n";
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
BB5E5FB53E7C451064DBC9A2 /* [CP] Check Pods Manifest.lock */ = {
|
||||
@@ -397,21 +364,6 @@
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
BF7EA699B063C96A45D69BF2 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InfiniteLayout_Example/Pods-InfiniteLayout_Example-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
DF297DCD753BC67E73166377 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
||||
@@ -12,6 +12,7 @@ import InfiniteLayout
|
||||
class CustomViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var infiniteCollectionView: InfiniteCollectionView!
|
||||
|
||||
}
|
||||
|
||||
extension CustomViewController: UICollectionViewDataSource {
|
||||
|
||||
+22
-13
@@ -1,16 +1,17 @@
|
||||
PODS:
|
||||
- CocoaProxy (0.1.1)
|
||||
- Differentiator (3.0.2)
|
||||
- InfiniteLayout (0.1.6):
|
||||
- CocoaProxy (~> 0.1)
|
||||
- InfiniteLayout/Core (= 0.1.6)
|
||||
- InfiniteLayout/Core (0.1.6):
|
||||
- CocoaProxy (~> 0.1)
|
||||
- InfiniteLayout/Rx (0.1.6):
|
||||
- CocoaProxy (~> 0.1)
|
||||
- RxCocoa (~> 4.0)
|
||||
- RxDataSources (~> 3.0)
|
||||
- RxSwift (~> 4.0)
|
||||
- InfiniteLayout (0.2.3.4):
|
||||
- CocoaProxy (~> 0)
|
||||
- InfiniteLayout/Core (= 0.2.3.4)
|
||||
- InfiniteLayout/Core (0.2.3.4):
|
||||
- CocoaProxy (~> 0)
|
||||
- InfiniteLayout/Rx (0.2.3.4):
|
||||
- CocoaProxy (~> 0)
|
||||
- InfiniteLayout/Core (~> 0)
|
||||
- RxCocoa (~> 4)
|
||||
- RxDataSources (~> 3)
|
||||
- RxSwift (~> 4)
|
||||
- RxCocoa (4.1.0):
|
||||
- RxSwift (~> 4.0)
|
||||
- RxDataSources (3.0.2):
|
||||
@@ -23,18 +24,26 @@ DEPENDENCIES:
|
||||
- InfiniteLayout (from `../`)
|
||||
- InfiniteLayout/Rx (from `../`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
- CocoaProxy
|
||||
- Differentiator
|
||||
- RxCocoa
|
||||
- RxDataSources
|
||||
- RxSwift
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
InfiniteLayout:
|
||||
:path: ../
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
CocoaProxy: 35ab81e24325b33834cffe45a3d1fd48ca67ef3a
|
||||
Differentiator: a87be69eba49ec4ab460c7671143ee3a9eececfd
|
||||
InfiniteLayout: 27a10e0a766122807a73740b5e7c7384fcdc37a2
|
||||
InfiniteLayout: 0a2d22c0d7c12051468b1bd1763875285f2e6815
|
||||
RxCocoa: cc1fec49cdc8fabe645964de7c51c099a36c2aa8
|
||||
RxDataSources: cb7c31e652a87ebb919da45f716bbb87b3765f6b
|
||||
RxSwift: 4219941c1244c88002901bd87a69d3aea9ae71f0
|
||||
|
||||
PODFILE CHECKSUM: 3501aeed91e62112dd38178a52f26b204b97c8c0
|
||||
|
||||
COCOAPODS: 1.4.0.rc.1
|
||||
COCOAPODS: 1.6.1
|
||||
|
||||
+10
-10
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'InfiniteLayout'
|
||||
s.version = '0.2.3'
|
||||
s.version = '0.3'
|
||||
s.summary = 'Horizontal and Vertical infinite scrolling feature for UICollectionView with Paging, NSProxy delegate, Reactive extension'
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
@@ -21,11 +21,11 @@ Pod::Spec.new do |s|
|
||||
Horizontal and Vertical infinite scrolling feature for UICollectionView with Paging, NSProxy delegate, Reactive extension, SectionModel & AnimatableSectionModel support
|
||||
DESC
|
||||
|
||||
s.homepage = 'https://github.com/Arnoymous/InfiniteLayout'
|
||||
s.screenshots = 'https://github.com/Arnoymous/InfiniteLayout/raw/master/horizontal.gif', 'https://github.com/Arnoymous/InfiniteLayout/raw/master/vertical.gif', 'https://github.com/Arnoymous/InfiniteLayout/raw/master/custom.gif', 'https://github.com/Arnoymous/InfiniteLayout/raw/master/delegate.gif'
|
||||
s.homepage = 'https://github.com/arnauddorgans/InfiniteLayout'
|
||||
s.screenshots = 'https://github.com/arnauddorgans/InfiniteLayout/raw/master/horizontal.gif', 'https://github.com/arnauddorgans/InfiniteLayout/raw/master/vertical.gif', 'https://github.com/arnauddorgans/InfiniteLayout/raw/master/custom.gif', 'https://github.com/arnauddorgans/InfiniteLayout/raw/master/delegate.gif'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'Arnoymous' => 'ineox@me.com' }
|
||||
s.source = { :git => 'https://github.com/Arnoymous/InfiniteLayout.git', :tag => s.version.to_s }
|
||||
s.author = { 'Arnaud Dorgans' => 'ineox@me.com' }
|
||||
s.source = { :git => 'https://github.com/arnauddorgans/InfiniteLayout.git', :tag => s.version.to_s }
|
||||
s.social_media_url = 'https://twitter.com/arnauddorgans'
|
||||
|
||||
s.ios.deployment_target = '8.0'
|
||||
@@ -39,7 +39,7 @@ Horizontal and Vertical infinite scrolling feature for UICollectionView with Pag
|
||||
|
||||
# s.public_header_files = 'Pod/Classes/**/*.h'
|
||||
# s.frameworks = 'UIKit', 'MapKit'
|
||||
s.dependency 'CocoaProxy', '~> 0.1'
|
||||
s.dependency 'CocoaProxy', '~> 0'
|
||||
|
||||
s.default_subspec = 'Core'
|
||||
|
||||
@@ -48,10 +48,10 @@ Horizontal and Vertical infinite scrolling feature for UICollectionView with Pag
|
||||
end
|
||||
|
||||
s.subspec 'Rx' do |rx|
|
||||
rx.dependency 'InfiniteLayout/Core', '~> 0.2'
|
||||
rx.dependency 'RxSwift', '~> 4.0'
|
||||
rx.dependency 'RxCocoa', '~> 4.0'
|
||||
rx.dependency 'RxDataSources', '~> 3.0'
|
||||
rx.dependency 'InfiniteLayout/Core', '~> 0'
|
||||
rx.dependency 'RxSwift', '~> 4'
|
||||
rx.dependency 'RxCocoa', '~> 4'
|
||||
rx.dependency 'RxDataSources', '~> 3'
|
||||
rx.source_files = 'InfiniteLayout/Rx/**/*'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ open class InfiniteCollectionView: UICollectionView {
|
||||
lazy var dataSourceProxy = InfiniteCollectionViewDataSourceProxy(collectionView: self)
|
||||
lazy var delegateProxy = InfiniteCollectionViewDelegateProxy(collectionView: self)
|
||||
|
||||
@IBOutlet open var infiniteDelegate: InfiniteCollectionViewDelegate?
|
||||
@IBOutlet open weak var infiniteDelegate: InfiniteCollectionViewDelegate?
|
||||
|
||||
open private(set) var centeredIndexPath: IndexPath?
|
||||
open var preferredCenteredIndexPath: IndexPath? = IndexPath(item: 0, section: 0)
|
||||
@@ -25,7 +25,7 @@ open class InfiniteCollectionView: UICollectionView {
|
||||
var forwardDelegate: Bool { return true }
|
||||
var _contentSize: CGSize?
|
||||
|
||||
override open var delegate: UICollectionViewDelegate? {
|
||||
override open weak var delegate: UICollectionViewDelegate? {
|
||||
get { return super.delegate }
|
||||
set {
|
||||
guard forwardDelegate else {
|
||||
@@ -45,7 +45,7 @@ open class InfiniteCollectionView: UICollectionView {
|
||||
}
|
||||
}
|
||||
|
||||
override open var dataSource: UICollectionViewDataSource? {
|
||||
override open weak var dataSource: UICollectionViewDataSource? {
|
||||
get { return super.dataSource }
|
||||
set {
|
||||
guard forwardDelegate else {
|
||||
@@ -134,7 +134,7 @@ extension InfiniteCollectionView: UICollectionViewDataSource {
|
||||
}
|
||||
|
||||
private var multiplier: Int {
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: self.infiniteLayout.itemSize)
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: self.infiniteLayout.itemSize, enabled: self.infiniteLayout.isEnabled)
|
||||
}
|
||||
|
||||
public func section(from infiniteSection: Int) -> Int {
|
||||
@@ -202,5 +202,6 @@ extension InfiniteCollectionView: UICollectionViewDelegate {
|
||||
if isItemPagingEnabled {
|
||||
self.infiniteLayout.centerCollectionView(withVelocity: velocity, targetContentOffset: targetContentOffset)
|
||||
}
|
||||
self.delegateProxy.delegate?.scrollViewWillEndDragging?(scrollView, withVelocity: velocity, targetContentOffset: targetContentOffset)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ class InfiniteCollectionViewProxy<T: NSObjectProtocol>: CocoaProxy {
|
||||
super.init(proxies: [])
|
||||
self.collectionView = collectionView
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.proxies.removeAll()
|
||||
}
|
||||
}
|
||||
|
||||
class InfiniteCollectionViewDelegateProxy: InfiniteCollectionViewProxy<UICollectionViewDelegate>, UICollectionViewDelegate {
|
||||
|
||||
@@ -17,7 +17,10 @@ class InfiniteDataSources {
|
||||
return IndexPath(item: infiniteIndexPath.item % numberOfItems, section: self.section(from: infiniteIndexPath.section, numberOfSections: numberOfSections))
|
||||
}
|
||||
|
||||
static func multiplier(estimatedItemSize: CGSize) -> Int {
|
||||
static func multiplier(estimatedItemSize: CGSize, enabled: Bool) -> Int {
|
||||
guard enabled else {
|
||||
return 1
|
||||
}
|
||||
let min = Swift.min(estimatedItemSize.width, estimatedItemSize.height)
|
||||
let count = ceil(InfiniteLayout.minimumContentSize / min)
|
||||
return Int(count)
|
||||
|
||||
@@ -15,7 +15,20 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
|
||||
private var contentSize: CGSize = .zero
|
||||
|
||||
private (set) var isEnabled: Bool = false
|
||||
private var hasValidLayout: Bool = false
|
||||
|
||||
@IBInspectable public var isEnabled: Bool = true {
|
||||
didSet {
|
||||
self.invalidateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
public var currentPage: CGPoint {
|
||||
guard let collectionView = self.collectionView else {
|
||||
return .zero
|
||||
}
|
||||
return self.page(for: collectionView.contentOffset)
|
||||
}
|
||||
|
||||
open override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
|
||||
return true
|
||||
@@ -42,8 +55,8 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
override open func prepare() {
|
||||
let collectionViewContentSize = super.collectionViewContentSize
|
||||
self.contentSize = CGSize(width: collectionViewContentSize.width, height: collectionViewContentSize.height)
|
||||
self.isEnabled = {
|
||||
guard let collectionView = self.collectionView, collectionView.bounds != .zero else {
|
||||
self.hasValidLayout = {
|
||||
guard let collectionView = self.collectionView, collectionView.bounds != .zero, self.isEnabled else {
|
||||
return false
|
||||
}
|
||||
return (scrollDirection == .horizontal ? self.contentSize.width : self.contentSize.height) >=
|
||||
@@ -53,15 +66,22 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
|
||||
override open var collectionViewContentSize: CGSize {
|
||||
guard isEnabled else {
|
||||
return super.collectionViewContentSize
|
||||
guard hasValidLayout else {
|
||||
return self.contentSize
|
||||
}
|
||||
return CGSize(width: scrollDirection == .horizontal ? self.contentSize.width * multiplier : self.contentSize.width,
|
||||
height: scrollDirection == .vertical ? self.contentSize.height * multiplier : self.contentSize.height)
|
||||
}
|
||||
|
||||
open override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
|
||||
guard let attributes = super.layoutAttributesForItem(at: indexPath) else {
|
||||
return nil
|
||||
}
|
||||
return self.layoutAttributes(from: attributes, page: currentPage)
|
||||
}
|
||||
|
||||
override open func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
|
||||
guard isEnabled else {
|
||||
guard hasValidLayout else {
|
||||
return super.layoutAttributesForElements(in: rect)
|
||||
}
|
||||
let page = self.page(for: rect.origin)
|
||||
@@ -143,7 +163,7 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
|
||||
public func loopCollectionViewIfNeeded() {
|
||||
guard let collectionView = self.collectionView, self.isEnabled else {
|
||||
guard let collectionView = self.collectionView, self.hasValidLayout else {
|
||||
return
|
||||
}
|
||||
let page = self.pageIndex(from: self.page(for: collectionView.contentOffset))
|
||||
@@ -233,7 +253,7 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
|
||||
public func centerCollectionView(withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
|
||||
guard let collectionView = self.collectionView, self.isEnabled else {
|
||||
guard let collectionView = self.collectionView, self.hasValidLayout else {
|
||||
return
|
||||
}
|
||||
let newTarget = CGPoint(x: self.scrollDirection == .horizontal ? collectionView.contentOffset.x + velocity.x * velocityMultiplier : targetContentOffset.pointee.x,
|
||||
@@ -247,7 +267,7 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
}
|
||||
|
||||
public func centerCollectionViewIfNeeded(indexPath: IndexPath? = nil) {
|
||||
guard let collectionView = self.collectionView, self.isEnabled else {
|
||||
guard let collectionView = self.collectionView, self.hasValidLayout else {
|
||||
return
|
||||
}
|
||||
guard let preferredAttributes = self.preferredVisibleLayoutAttributes(indexPath: indexPath),
|
||||
|
||||
@@ -9,6 +9,8 @@ import UIKit
|
||||
import RxDataSources
|
||||
|
||||
open class RxInfiniteCollectionViewSectionedReloadDataSource<S: SectionModelType>: RxCollectionViewSectionedReloadDataSource<S> {
|
||||
|
||||
public var isEnabled: Bool = true
|
||||
|
||||
open override subscript(section: Int) -> S {
|
||||
let section = InfiniteDataSources.section(from: section, numberOfSections: sectionModels.count)
|
||||
@@ -33,7 +35,7 @@ open class RxInfiniteCollectionViewSectionedReloadDataSource<S: SectionModelType
|
||||
guard let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout else {
|
||||
fatalError()
|
||||
}
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: layout.itemSize)
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: layout.itemSize, enabled: isEnabled)
|
||||
}
|
||||
|
||||
open override func numberOfSections(in collectionView: UICollectionView) -> Int {
|
||||
@@ -54,6 +56,8 @@ open class RxInfiniteCollectionViewSectionedReloadDataSource<S: SectionModelType
|
||||
|
||||
open class RxInfiniteCollectionViewSectionedAnimatedDataSource<S: AnimatableSectionModelType>: RxCollectionViewSectionedAnimatedDataSource<S> {
|
||||
|
||||
public var isEnabled: Bool = true
|
||||
|
||||
open override subscript(section: Int) -> S {
|
||||
let section = InfiniteDataSources.section(from: section, numberOfSections: sectionModels.count)
|
||||
return self.sectionModels[section]
|
||||
@@ -77,7 +81,7 @@ open class RxInfiniteCollectionViewSectionedAnimatedDataSource<S: AnimatableSect
|
||||
guard let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout else {
|
||||
fatalError()
|
||||
}
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: layout.itemSize)
|
||||
return InfiniteDataSources.multiplier(estimatedItemSize: layout.itemSize, enabled: isEnabled)
|
||||
}
|
||||
|
||||
open override func numberOfSections(in collectionView: UICollectionView) -> Int {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# InfiniteLayout
|
||||
|
||||
[](https://travis-ci.org/Arnoymous/InfiniteLayout)
|
||||
[](https://travis-ci.org/arnauddorgans/InfiniteLayout)
|
||||
[](http://cocoapods.org/pods/InfiniteLayout)
|
||||
[](http://cocoapods.org/pods/InfiniteLayout)
|
||||
[](http://cocoapods.org/pods/InfiniteLayout)
|
||||
|
||||
<img src="https://github.com/Arnoymous/InfiniteLayout/raw/master/horizontal.gif" width="250" height="540"><img src="https://github.com/Arnoymous/InfiniteLayout/raw/master/vertical.gif" width="250" height="540"><img src="https://github.com/Arnoymous/InfiniteLayout/raw/master/custom.gif" width="250" height="540">
|
||||
<img src="https://github.com/arnauddorgans/InfiniteLayout/raw/master/horizontal.gif" width="250" height="540"><img src="https://github.com/arnauddorgans/InfiniteLayout/raw/master/vertical.gif" width="250" height="540"><img src="https://github.com/arnauddorgans/InfiniteLayout/raw/master/custom.gif" width="250" height="540">
|
||||
|
||||
|
||||
## Example
|
||||
@@ -80,7 +80,7 @@ self.infiniteCollectionView.preferredCenteredIndexPath = nil // center the close
|
||||
|
||||
### Delegate
|
||||
|
||||
<img src="https://github.com/Arnoymous/InfiniteLayout/raw/master/delegate.gif" width="250" height="540">
|
||||
<img src="https://github.com/arnauddorgans/InfiniteLayout/raw/master/delegate.gif" width="250" height="540">
|
||||
|
||||
InfiniteCollectionView provide an **infiniteDelegate** protocol used to get the centered IndexPath, usefull if you want to use an InfiniteCollectionView like a Picker.
|
||||
|
||||
@@ -151,20 +151,20 @@ RxInfiniteCollectionView provide Reactive extension for **itemCentered** & **mod
|
||||
```swift
|
||||
infiniteCollectionView.rx.itemCentered
|
||||
.asDriver()
|
||||
.drive(onNext: { indexPath in
|
||||
.drive(onNext: { [unowned self] indexPath in
|
||||
self.selectedView.update(index: indexPath.row) // update interface with indexPath
|
||||
}).disposed(by: disposeBag)
|
||||
|
||||
infiniteCollectionView.rx.modelCentered(Int.self)
|
||||
.asDriver()
|
||||
.drive(onNext: { element in
|
||||
.drive(onNext: { [unowned self] element in
|
||||
self.selectedView.update(index: element) // update interface with model
|
||||
}).disposed(by: disposeBag)
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
Arnoymous, arnaud.dorgans@gmail.com
|
||||
Arnaud Dorgans, arnaud.dorgans@gmail.com
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in New Issue
Block a user