Fixes problem with data sources.

This commit is contained in:
Krunoslav Zaher 2016-08-07 15:23:17 +02:00
parent 58e427b045
commit 7b6a244f45
4 changed files with 13 additions and 10 deletions

View File

@ -13,7 +13,7 @@ There are two main operators that work with schedulers, `observeOn` and `subscri
If you want to perform work on a different scheduler just use `observeOn(scheduler)` operator. If you want to perform work on a different scheduler just use `observeOn(scheduler)` operator.
You would usually use `observeOn` a lot more often then `subscribeOn`. You would usually use `observeOn` a lot more often than `subscribeOn`.
In case `observeOn` isn't explicitly specified, work will be performed on whichever thread/scheduler elements are generated. In case `observeOn` isn't explicitly specified, work will be performed on whichever thread/scheduler elements are generated.

View File

@ -178,14 +178,14 @@ extension DelegateProxyType {
let maybeProxy = Self.assignedProxyFor(object) as? Self let maybeProxy = Self.assignedProxyFor(object) as? Self
let proxy: Self let proxy: Self
if maybeProxy == nil { if let existingProxy = maybeProxy {
proxy = existingProxy
}
else {
proxy = Self.createProxyForObject(object) as! Self proxy = Self.createProxyForObject(object) as! Self
Self.assignProxy(proxy, toObject: object) Self.assignProxy(proxy, toObject: object)
assert(Self.assignedProxyFor(object) === proxy) assert(Self.assignedProxyFor(object) === proxy)
} }
else {
proxy = maybeProxy!
}
let currentDelegate: AnyObject? = Self.currentDelegateFor(object) let currentDelegate: AnyObject? = Self.currentDelegateFor(object)

View File

@ -19,8 +19,10 @@ let collectionViewDataSourceNotSet = CollectionViewDataSourceNotSet()
class CollectionViewDataSourceNotSet class CollectionViewDataSourceNotSet
: NSObject : NSObject
, UICollectionViewDataSource { , UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
rxAbstractMethodWithMessage(dataSourceNotSet) return 0
} }
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:

View File

@ -19,8 +19,9 @@ let tableViewDataSourceNotSet = TableViewDataSourceNotSet()
class TableViewDataSourceNotSet class TableViewDataSourceNotSet
: NSObject : NSObject
, UITableViewDataSource { , UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
rxAbstractMethodWithMessage(dataSourceNotSet) func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 0
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
@ -62,8 +63,8 @@ public class RxTableViewDataSourceProxy
/** /**
Required delegate method implementation. Required delegate method implementation.
*/ */
public func numberOfSections(in tableView: UITableView) -> Int { public func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).numberOfSections?(in: tableView) ?? 1 return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).numberOfSections?(in: tableView) ?? 0
} }
/** /**