Adds `cellType` parameter to `rx_itemsWithCellIdentifier`.
This commit is contained in:
parent
26819fff60
commit
3d55baa4e1
|
|
@ -39,10 +39,11 @@ extension UICollectionView {
|
|||
- parameter cellIdentifier: Identifier used to dequeue cells.
|
||||
- parameter source: Observable sequence of items.
|
||||
- parameter configureCell: Transform between sequence elements and view cells.
|
||||
- parameter cellType: Type of table view cell.
|
||||
- returns: Disposable object that can be used to unbind.
|
||||
*/
|
||||
public func rx_itemsWithCellIdentifier<S: SequenceType, Cell: UICollectionViewCell, O : ObservableType where O.E == S>
|
||||
(cellIdentifier: String)
|
||||
(cellIdentifier: String, cellType: Cell.Type = Cell.self)
|
||||
(source: O)
|
||||
(configureCell: (Int, S.Generator.Element, Cell) -> Void)
|
||||
-> Disposable {
|
||||
|
|
|
|||
|
|
@ -40,10 +40,11 @@ extension UITableView {
|
|||
- parameter cellIdentifier: Identifier used to dequeue cells.
|
||||
- parameter source: Observable sequence of items.
|
||||
- parameter configureCell: Transform between sequence elements and view cells.
|
||||
- parameter cellType: Type of table view cell.
|
||||
- returns: Disposable object that can be used to unbind.
|
||||
*/
|
||||
public func rx_itemsWithCellIdentifier<S: SequenceType, Cell: UITableViewCell, O : ObservableType where O.E == S>
|
||||
(cellIdentifier: String)
|
||||
(cellIdentifier: String, cellType: Cell.Type = Cell.self)
|
||||
(source: O)
|
||||
(configureCell: (Int, S.Generator.Element, Cell) -> Void)
|
||||
-> Disposable {
|
||||
|
|
|
|||
|
|
@ -470,6 +470,34 @@
|
|||
remoteGlobalIDString = C8F0C0581BBBFBCE001B112F;
|
||||
remoteInfo = "RxBlocking-watchOS";
|
||||
};
|
||||
C8864C591C275A200073016D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = C88FA50C1C25C44800CCFEA4;
|
||||
remoteInfo = "RxTests-iOS";
|
||||
};
|
||||
C8864C5B1C275A200073016D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = C88FA51D1C25C4B500CCFEA4;
|
||||
remoteInfo = "RxTests-OSX";
|
||||
};
|
||||
C8864C5D1C275A200073016D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = C88FA52E1C25C4C000CCFEA4;
|
||||
remoteInfo = "RxTests-tvOS";
|
||||
};
|
||||
C8864C5F1C275A200073016D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = C81B39F11BC1C28400EF5A9F /* Rx.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = C88FA53F1C25C4CC00CCFEA4;
|
||||
remoteInfo = "RxTests-watchOS";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
|
|
@ -919,6 +947,10 @@
|
|||
C81B3A131BC1C28400EF5A9F /* RxBlocking.framework */,
|
||||
C81B3A151BC1C28400EF5A9F /* RxBlocking.framework */,
|
||||
C81B3A171BC1C28400EF5A9F /* RxBlocking.framework */,
|
||||
C8864C5A1C275A200073016D /* RxTests.framework */,
|
||||
C8864C5C1C275A200073016D /* RxTests.framework */,
|
||||
C8864C5E1C275A200073016D /* RxTests.framework */,
|
||||
C8864C601C275A200073016D /* RxTests.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -1741,6 +1773,34 @@
|
|||
remoteRef = C81B3A161BC1C28400EF5A9F /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
C8864C5A1C275A200073016D /* RxTests.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = RxTests.framework;
|
||||
remoteRef = C8864C591C275A200073016D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
C8864C5C1C275A200073016D /* RxTests.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = RxTests.framework;
|
||||
remoteRef = C8864C5B1C275A200073016D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
C8864C5E1C275A200073016D /* RxTests.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = RxTests.framework;
|
||||
remoteRef = C8864C5D1C275A200073016D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
C8864C601C275A200073016D /* RxTests.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = RxTests.framework;
|
||||
remoteRef = C8864C5F1C275A200073016D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
|
|
@ -2297,6 +2357,7 @@
|
|||
C83367001AD0293900C668A7 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
INFOPLIST_FILE = "RxExample/Info-iOS.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
|
|
@ -2310,6 +2371,7 @@
|
|||
C83367011AD0293900C668A7 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
INFOPLIST_FILE = "RxExample/Info-iOS.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
|
|
@ -2391,6 +2453,7 @@
|
|||
C8DF92EE1B0B3DFA009BCF9A /* Release-Tests */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
INFOPLIST_FILE = "RxExample/Info-iOS.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class SimpleTableViewExampleViewController : ViewController {
|
|||
])
|
||||
|
||||
items
|
||||
.bindTo(tableView.rx_itemsWithCellIdentifier("Cell")) { (row, element, cell) in
|
||||
.bindTo(tableView.rx_itemsWithCellIdentifier("Cell", cellType: UITableViewCell.self)) { (row, element, cell) in
|
||||
cell.textLabel?.text = "\(element) @ row \(row)"
|
||||
}
|
||||
.addDisposableTo(disposeBag)
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ public class WikipediaSearchCell: UITableViewCell {
|
|||
self.URLOutlet.text = viewModel.searchResult.URL.absoluteString ?? ""
|
||||
|
||||
viewModel.imageURLs
|
||||
.drive(self.imagesOutlet.rx_itemsWithCellIdentifier("ImageCell")) { [unowned self] (_, URL, cell: CollectionViewImageCell) in
|
||||
cell.downloadableImage = self.imageService.imageFromURL(URL)
|
||||
.drive(self.imagesOutlet.rx_itemsWithCellIdentifier("ImageCell", cellType: CollectionViewImageCell.self)) { [weak self] (_, URL, cell) in
|
||||
cell.downloadableImage = self?.imageService.imageFromURL(URL) ?? empty()
|
||||
}
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class WikipediaSearchViewController: ViewController {
|
|||
.map { results in
|
||||
results.map(SearchResultViewModel.init)
|
||||
}
|
||||
.drive(resultsTableView.rx_itemsWithCellIdentifier("WikipediaSearchCell")) { (_, viewModel, cell: WikipediaSearchCell) in
|
||||
.drive(resultsTableView.rx_itemsWithCellIdentifier("WikipediaSearchCell", cellType: WikipediaSearchCell.self)) { (_, viewModel, cell) in
|
||||
cell.viewModel = viewModel
|
||||
}
|
||||
.addDisposableTo(disposeBag)
|
||||
|
|
|
|||
Loading…
Reference in New Issue