diff --git a/RxCocoa/iOS/UICollectionView+Rx.swift b/RxCocoa/iOS/UICollectionView+Rx.swift index 59c630ff..336446cb 100644 --- a/RxCocoa/iOS/UICollectionView+Rx.swift +++ b/RxCocoa/iOS/UICollectionView+Rx.swift @@ -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 - (cellIdentifier: String) + (cellIdentifier: String, cellType: Cell.Type = Cell.self) (source: O) (configureCell: (Int, S.Generator.Element, Cell) -> Void) -> Disposable { diff --git a/RxCocoa/iOS/UITableView+Rx.swift b/RxCocoa/iOS/UITableView+Rx.swift index af3ad282..66c4045c 100644 --- a/RxCocoa/iOS/UITableView+Rx.swift +++ b/RxCocoa/iOS/UITableView+Rx.swift @@ -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 - (cellIdentifier: String) + (cellIdentifier: String, cellType: Cell.Type = Cell.self) (source: O) (configureCell: (Int, S.Generator.Element, Cell) -> Void) -> Disposable { diff --git a/RxExample/RxExample.xcodeproj/project.pbxproj b/RxExample/RxExample.xcodeproj/project.pbxproj index 71beb12b..ca02f20c 100644 --- a/RxExample/RxExample.xcodeproj/project.pbxproj +++ b/RxExample/RxExample.xcodeproj/project.pbxproj @@ -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 = ""; @@ -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"; diff --git a/RxExample/RxExample/Examples/SimpleTableViewExample/SimpleTableViewExampleViewController.swift b/RxExample/RxExample/Examples/SimpleTableViewExample/SimpleTableViewExampleViewController.swift index 05753a81..dbdf45aa 100644 --- a/RxExample/RxExample/Examples/SimpleTableViewExample/SimpleTableViewExampleViewController.swift +++ b/RxExample/RxExample/Examples/SimpleTableViewExample/SimpleTableViewExampleViewController.swift @@ -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) diff --git a/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift b/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift index 4d0dfa62..e3d9a87d 100644 --- a/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift +++ b/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift @@ -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) diff --git a/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchViewController.swift b/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchViewController.swift index c0762c07..920515ed 100644 --- a/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchViewController.swift +++ b/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchViewController.swift @@ -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)