Compare commits

...

5 Commits

Author SHA1 Message Date
Arnaud Dorgans a576a83530 Merge pull request #30 from lm2343635/master
Support RxSwift 6+
2021-07-10 19:20:17 +02:00
Meng Li 4949a88839 Fix for build error 2021-07-09 23:53:25 +09:00
Meng Li 11e0c80586 Update RxSwift to 6.0 2021-07-09 23:51:29 +09:00
Arnaud Dorgans 0037147caf Merge pull request #16 from cdann-leafly/master
Update Package.swift manifest to define RxInfiniteLayout product
2020-02-18 00:13:59 +01:00
Chris D'Annunzio 35543f6b6c Update Package.swift manifest to define RxInfiniteLayout product and target, allowing RxSwift-related classes and extensions to be imported via Swift Package Manager. 2020-02-03 11:46:55 -08:00
10 changed files with 112 additions and 84 deletions
@@ -326,7 +326,6 @@
);
inputPaths = (
"${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",
"${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework",
@@ -336,7 +335,6 @@
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaProxy.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Differentiator.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/InfiniteLayout.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework",
@@ -29,10 +29,6 @@ class RxBaseCollectionViewController: UIViewController {
infiniteCollectionView.rx.modelCentered(Int.self)
.asDriver()
.drive(onNext: { current in
guard let current = current else {
print("centered: none")
return
}
print("centered: \(current + 1)")
}).disposed(by: disposeBag)
+29 -33
View File
@@ -1,35 +1,32 @@
PODS:
- CocoaProxy (0.1.1)
- Differentiator (4.0.1)
- InfiniteLayout (0.4.1):
- CocoaProxy (~> 0)
- InfiniteLayout/Core (= 0.4.1)
- InfiniteLayout/Core (0.4.1):
- CocoaProxy (~> 0)
- InfiniteLayout/Rx (0.4.1):
- CocoaProxy (~> 0)
- InfiniteLayout/Core (~> 0)
- RxCocoa (~> 5)
- RxDataSources (~> 4)
- RxSwift (~> 5)
- RxCocoa (5.0.0):
- RxRelay (~> 5)
- RxSwift (~> 5)
- RxDataSources (4.0.1):
- Differentiator (~> 4.0)
- RxCocoa (~> 5.0)
- RxSwift (~> 5.0)
- RxRelay (5.0.0):
- RxSwift (~> 5)
- RxSwift (5.0.0)
- Differentiator (5.0.0)
- InfiniteLayout (0.5):
- InfiniteLayout/Core (= 0.5)
- InfiniteLayout/CocoaProxy (0.5)
- InfiniteLayout/Core (0.5):
- InfiniteLayout/CocoaProxy
- InfiniteLayout/Rx (0.5):
- InfiniteLayout/Core
- RxCocoa (~> 6)
- RxDataSources (~> 5)
- RxSwift (~> 6)
- RxCocoa (6.2.0):
- RxRelay (= 6.2.0)
- RxSwift (= 6.2.0)
- RxDataSources (5.0.0):
- Differentiator (~> 5.0)
- RxCocoa (~> 6.0)
- RxSwift (~> 6.0)
- RxRelay (6.2.0):
- RxSwift (= 6.2.0)
- RxSwift (6.2.0)
DEPENDENCIES:
- InfiniteLayout (from `../`)
- InfiniteLayout/Rx (from `../`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- CocoaProxy
trunk:
- Differentiator
- RxCocoa
- RxDataSources
@@ -41,14 +38,13 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
CocoaProxy: 35ab81e24325b33834cffe45a3d1fd48ca67ef3a
Differentiator: 886080237d9f87f322641dedbc5be257061b0602
InfiniteLayout: 458eadbcb94afc3d777141990fbfe7a804a35609
RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8
RxDataSources: efee07fa4de48477eca0a4611e6d11e2da9c1114
RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18
RxSwift: 8b0671caa829a763bbce7271095859121cbd895f
Differentiator: e8497ceab83c1b10ca233716d547b9af21b9344d
InfiniteLayout: 2c55b0fc14b6a9d924fbe13c0e2d88b1cbf5423d
RxCocoa: 4baf94bb35f2c0ab31bc0cb9f1900155f646ba42
RxDataSources: aa47cc1ed6c500fa0dfecac5c979b723542d79cf
RxRelay: e72dbfd157807478401ef1982e1c61c945c94b2f
RxSwift: d356ab7bee873611322f134c5f9ef379fa183d8f
PODFILE CHECKSUM: 0dc7a9b37f9b7c5d5266beaab9e94861b80aa80f
COCOAPODS: 1.6.1
COCOAPODS: 1.10.1
+5 -5
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'InfiniteLayout'
s.version = '0.4.2'
s.version = '0.5'
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.
@@ -28,7 +28,7 @@ Horizontal and Vertical infinite scrolling feature for UICollectionView with Pag
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'
s.ios.deployment_target = '9.0'
s.tvos.deployment_target = '9.0'
#s.xcconfig = { 'SWIFT_OBJC_BRIDGING_HEADER' => '${POD_ROOT}/InfiniteLayout/BridgeHeader.h' }
@@ -53,9 +53,9 @@ Horizontal and Vertical infinite scrolling feature for UICollectionView with Pag
end
s.subspec 'Rx' do |rx|
rx.dependency 'InfiniteLayout/Core'
rx.dependency 'RxSwift', '~> 5'
rx.dependency 'RxCocoa', '~> 5'
rx.dependency 'RxDataSources', '~> 4'
rx.dependency 'RxSwift', '~> 6'
rx.dependency 'RxCocoa', '~> 6'
rx.dependency 'RxDataSources', '~> 5'
rx.source_files = 'Sources/Rx/**/*'
end
end
+30 -23
View File
@@ -4,27 +4,34 @@
import PackageDescription
let package = Package(
name: "InfiniteLayout",
platforms: [.iOS(.v8), .tvOS(.v9)],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "InfiniteLayout",
targets: ["InfiniteLayout"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "CocoaProxy",
dependencies: [],
publicHeadersPath: "./"),
.target(
name: "InfiniteLayout",
dependencies: ["CocoaProxy"])
]
name: "InfiniteLayout",
platforms: [.iOS(.v9), .tvOS(.v9)],
products: [
.library(
name: "InfiniteLayout",
targets: ["InfiniteLayout"]),
.library(
name: "RxInfiniteLayout",
targets: ["RxInfiniteLayout"]),
],
dependencies: [
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.0.0")),
.package(url: "https://github.com/RxSwiftCommunity/RxDataSources.git", .upToNextMajor(from: "5.0.0")),
],
targets: [
.target(
name: "CocoaProxy",
dependencies: [],
publicHeadersPath: "./"
),
.target(
name: "InfiniteLayout",
dependencies: ["CocoaProxy"]
),
.target(
name: "RxInfiniteLayout",
dependencies: ["InfiniteLayout", "RxSwift", "RxCocoa", "RxDataSources"],
path: "Sources/Rx"
),
]
)
@@ -22,7 +22,7 @@ open class InfiniteCollectionView: UICollectionView {
open private(set) var centeredIndexPath: IndexPath?
open var preferredCenteredIndexPath: IndexPath? = IndexPath(item: 0, section: 0)
var forwardDelegate: Bool { return true }
open var forwardDelegate: Bool { return true }
var _contentSize: CGSize?
override open weak var delegate: UICollectionViewDelegate? {
+11 -10
View File
@@ -7,17 +7,17 @@
import UIKit
class InfiniteDataSources {
static func section(from infiniteSection: Int, numberOfSections: Int) -> Int {
open class InfiniteDataSources {
public static var originCount: Int = 0
public static func section(from infiniteSection: Int, numberOfSections: Int) -> Int {
return infiniteSection % numberOfSections
}
static func indexPath(from infiniteIndexPath: IndexPath, numberOfSections: Int, numberOfItems: Int) -> IndexPath {
public static func indexPath(from infiniteIndexPath: IndexPath, numberOfSections: Int, numberOfItems: Int) -> IndexPath {
return IndexPath(item: infiniteIndexPath.item % numberOfItems, section: self.section(from: infiniteIndexPath.section, numberOfSections: numberOfSections))
}
static func multiplier(estimatedItemSize: CGSize, enabled: Bool) -> Int {
public static func multiplier(estimatedItemSize: CGSize, enabled: Bool) -> Int {
guard enabled else {
return 1
}
@@ -25,12 +25,13 @@ class InfiniteDataSources {
let count = ceil(InfiniteLayout.minimumContentSize / min)
return Int(count)
}
static func numberOfSections(numberOfSections: Int, multiplier: Int) -> Int {
public static func numberOfSections(numberOfSections: Int, multiplier: Int) -> Int {
return numberOfSections > 1 ? numberOfSections * multiplier : numberOfSections
}
static func numberOfItemsInSection(numberOfItemsInSection: Int, numberOfSections: Int, multiplier: Int) -> Int {
public static func numberOfItemsInSection(numberOfItemsInSection: Int, numberOfSections: Int, multiplier: Int) -> Int {
originCount = numberOfItemsInSection
return numberOfSections > 1 ? numberOfItemsInSection : numberOfItemsInSection * multiplier
}
}
+27 -5
View File
@@ -5,6 +5,10 @@
// Created by Arnaud Dorgans on 03/01/2018.
//
#if canImport(InfiniteLayout)
import InfiniteLayout
#endif
import UIKit
import RxSwift
import RxCocoa
@@ -42,12 +46,30 @@ extension Reactive where Base: InfiniteCollectionView {
.map { $0.last as? IndexPath }
return ControlEvent(events: source)
}
public func modelCentered<T>(_ type: T.Type) -> ControlEvent<T?> {
let source = itemCentered
.map { indexPath -> T? in
return try indexPath.flatMap { try self.model(at: $0) }
public func modelCentered<T>(_ type: T.Type) -> ControlEvent<T> {
let source: Observable<T> = itemCentered.flatMap { [weak view = self.base as InfiniteCollectionView] indexPath -> Observable<T> in
guard let view = view, var indexPath = indexPath else {
return Observable.empty()
}
indexPath.row %= InfiniteDataSources.originCount
return Observable.just(try view.rx.model(at: indexPath))
}
return ControlEvent(events: source)
}
public func modelSelected<T>(_ modelType: T.Type) -> ControlEvent<T> {
let source: Observable<T> = itemSelected.flatMap { [weak view = self.base as InfiniteCollectionView] indexPath -> Observable<T> in
guard let view = view else {
return Observable.empty()
}
var indexPath = indexPath
indexPath.row %= InfiniteDataSources.originCount
return Observable.just(try view.rx.model(at: indexPath))
}
return ControlEvent(events: source)
}
}
+5 -1
View File
@@ -5,6 +5,10 @@
// Created by Arnaud Dorgans on 03/01/2018.
//
#if canImport(InfiniteLayout)
import InfiniteLayout
#endif
import UIKit
import RxSwift
import RxCocoa
@@ -13,7 +17,7 @@ open class RxInfiniteCollectionView: InfiniteCollectionView {
let disposeBag = DisposeBag()
override var forwardDelegate: Bool {
override open var forwardDelegate: Bool {
return false
}
@@ -5,6 +5,10 @@
// Created by Arnaud Dorgans on 03/01/2018.
//
#if canImport(InfiniteLayout)
import InfiniteLayout
#endif
import UIKit
import RxDataSources