Update some variable and function names to be consistent with UIKit. Add changelog entry

This commit is contained in:
Rowan Livingstone 2018-02-16 10:06:24 +13:00
parent edf5cec945
commit eab261cf0a
5 changed files with 17 additions and 20 deletions

View File

@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
* Lower macOS Deployment Target to 10.9
* Add `zip<C: Collection>(_ collection: C)` to Single trait
* Add Smart Key Path subscripting to create a binder for property of object.
* Add `UICollectionView.rx.prefetchItems`, `UICollectionView.rx.cancelPrefetchingForItems`, `UITableView.rx.prefetchRows`, and `UITableView.rx.cancelPrefetchingForRows`.
#### Anomalies

View File

@ -133,11 +133,9 @@
B44D73EC1EE6D4A300EBFBE8 /* UIViewController+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271A97421CFC99FE00D64125 /* UIViewController+RxTests.swift */; };
B44D73ED1EE6D57600EBFBE8 /* UIViewController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271A97401CFC996B00D64125 /* UIViewController+Rx.swift */; };
B562478F203515DD00D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */; };
B5624790203515DE00D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */; };
B5624791203515DF00D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */; };
B5624792203515DF00D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */; };
B5624794203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */; };
B5624795203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */; };
B5624796203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */; };
B5624797203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */; };
C801DE361F6EAD3C008DB060 /* SingleTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C801DE351F6EAD3C008DB060 /* SingleTest.swift */; };
@ -1805,8 +1803,8 @@
A520FFFB1F0D291500573734 /* RxPickerViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxPickerViewDataSourceProxy.swift; sourceTree = "<group>"; };
A5CD03891F1660F40005A376 /* RxPickerViewAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxPickerViewAdapter.swift; sourceTree = "<group>"; };
AAE623751C82475700FC7801 /* UIProgressView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIProgressView+Rx.swift"; sourceTree = "<group>"; };
B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDataSourcePrefetchingProxy.swift; sourceTree = "<group>"; };
B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxTableViewDataSourcePrefetchingProxy.swift; sourceTree = "<group>"; };
B562478D2035154900D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDataSourcePrefetchingProxy.swift; sourceTree = "<group>"; };
B5624793203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewDataSourcePrefetchingProxy.swift; sourceTree = "<group>"; };
C801DE351F6EAD3C008DB060 /* SingleTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleTest.swift; sourceTree = "<group>"; };
C801DE391F6EAD48008DB060 /* MaybeTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaybeTest.swift; sourceTree = "<group>"; };
C801DE3D1F6EAD57008DB060 /* CompletableTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompletableTest.swift; sourceTree = "<group>"; };
@ -4259,7 +4257,6 @@
C88F76821CE5341700D5A014 /* TextInput.swift in Sources */,
C8C8BCD01F8944B800501D4D /* BehaviorRelay.swift in Sources */,
C8091C581FAA39C1001DB32A /* ControlEvent+Signal.swift in Sources */,
B5624795203532F500D3EE75 /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */,
C89AB1DF1DAAC3350065FBE6 /* ObservableConvertibleType+Driver.swift in Sources */,
6B9CA56C202A1F44002C2D11 /* KeyPathBinder.swift in Sources */,
C89AB1D71DAAC3350065FBE6 /* Driver+Subscription.swift in Sources */,
@ -4291,7 +4288,6 @@
C8093EE21B8A732E0088E94D /* DelegateProxy.swift in Sources */,
C89AB1F31DAAC3350065FBE6 /* SharedSequence+Operators.swift in Sources */,
C8B0F71A1F530FE400548EBE /* PublishRelay.swift in Sources */,
B5624790203515DE00D3EE75 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */,
C86781A61DB823B500B2029A /* NSSlider+Rx.swift in Sources */,
C89AB2231DAAC3350065FBE6 /* URLSession+Rx.swift in Sources */,
C86781A11DB823B500B2029A /* NSImageView+Rx.swift in Sources */,

View File

@ -43,16 +43,16 @@ open class RxTableViewDataSourcePrefetchingProxy: DelegateProxy<UITableView, UIT
self.register { RxTableViewDataSourcePrefetchingProxy(tableView: $0) }
}
fileprivate var _prefetchItemsPublishSubject: PublishSubject<[IndexPath]>?
fileprivate var _prefetchRowsPublishSubject: PublishSubject<[IndexPath]>?
/// Optimized version used for observing prefetch items callbacks.
internal var prefetchItemsPublishSubject: PublishSubject<[IndexPath]> {
if let subject = _prefetchItemsPublishSubject {
/// Optimized version used for observing prefetch rows callbacks.
internal var prefetchRowsPublishSubject: PublishSubject<[IndexPath]> {
if let subject = _prefetchRowsPublishSubject {
return subject
}
let subject = PublishSubject<[IndexPath]>()
_prefetchItemsPublishSubject = subject
_prefetchRowsPublishSubject = subject
return subject
}
@ -63,7 +63,7 @@ open class RxTableViewDataSourcePrefetchingProxy: DelegateProxy<UITableView, UIT
/// Required delegate method implementation.
public func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {
if let subject = _prefetchItemsPublishSubject {
if let subject = _prefetchRowsPublishSubject {
subject.on(.next(indexPaths))
}
@ -77,7 +77,7 @@ open class RxTableViewDataSourcePrefetchingProxy: DelegateProxy<UITableView, UIT
}
deinit {
if let subject = _prefetchItemsPublishSubject {
if let subject = _prefetchRowsPublishSubject {
subject.on(.completed)
}
}

View File

@ -397,13 +397,13 @@ extension Reactive where Base: UITableView {
}
/// Reactive wrapper for `prefetchDataSource` message `tableView(_:prefetchRowsAt:)`.
public var prefetchItems: ControlEvent<[IndexPath]> {
let source = RxTableViewDataSourcePrefetchingProxy.proxy(for: base).prefetchItemsPublishSubject
public var prefetchRows: ControlEvent<[IndexPath]> {
let source = RxTableViewDataSourcePrefetchingProxy.proxy(for: base).prefetchRowsPublishSubject
return ControlEvent(events: source)
}
/// Reactive wrapper for `prefetchDataSource` message `tableView(_:cancelPrefetchingForRowsAt:)`.
public var cancelPrefetchingForItems: ControlEvent<[IndexPath]> {
public var cancelPrefetchingForRows: ControlEvent<[IndexPath]> {
let source = prefetchDataSource.methodInvoked(#selector(UITableViewDataSourcePrefetching.tableView(_:cancelPrefetchingForRowsAt:)))
.map { a in
return try castOrThrow(Array<IndexPath>.self, a[1])

View File

@ -219,12 +219,12 @@ final class UITableViewTests : RxTest {
}
@available(iOS 10.0, tvOS 10.0, *)
func test_prefetchItems() {
func test_prefetchRows() {
let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: 1, height: 1))
var indexPaths: [IndexPath] = []
let subscription = tableView.rx.prefetchItems
let subscription = tableView.rx.prefetchRows
.subscribe(onNext: {
indexPaths = $0
})
@ -237,12 +237,12 @@ final class UITableViewTests : RxTest {
}
@available(iOS 10.0, tvOS 10.0, *)
func test_cancelPrefetchingForItems() {
func test_cancelPrefetchingForRows() {
let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: 1, height: 1))
var indexPaths: [IndexPath] = []
let subscription = tableView.rx.cancelPrefetchingForItems
let subscription = tableView.rx.cancelPrefetchingForRows
.subscribe(onNext: {
indexPaths = $0
})