Fixes default datasources implementation. #825
This commit is contained in:
parent
bfb9441414
commit
e2c3330d61
|
|
@ -178,14 +178,14 @@ extension DelegateProxyType {
|
|||
let maybeProxy = Self.assignedProxyFor(object) as? Self
|
||||
|
||||
let proxy: Self
|
||||
if maybeProxy == nil {
|
||||
if let existingProxy = maybeProxy {
|
||||
proxy = existingProxy
|
||||
}
|
||||
else {
|
||||
proxy = Self.createProxyForObject(object) as! Self
|
||||
Self.assignProxy(proxy, toObject: object)
|
||||
assert(Self.assignedProxyFor(object) === proxy)
|
||||
}
|
||||
else {
|
||||
proxy = maybeProxy!
|
||||
}
|
||||
|
||||
let currentDelegate: AnyObject? = Self.currentDelegateFor(object)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@ let collectionViewDataSourceNotSet = CollectionViewDataSourceNotSet()
|
|||
class CollectionViewDataSourceNotSet
|
||||
: NSObject
|
||||
, UICollectionViewDataSource {
|
||||
|
||||
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
rxAbstractMethodWithMessage(dataSourceNotSet)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class TableViewDataSourceNotSet
|
|||
: NSObject
|
||||
, UITableViewDataSource {
|
||||
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
rxAbstractMethodWithMessage(dataSourceNotSet)
|
||||
return 0
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
|
|
@ -63,7 +63,7 @@ public class RxTableViewDataSourceProxy
|
|||
Required delegate method implementation.
|
||||
*/
|
||||
public func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).numberOfSectionsInTableView?(tableView) ?? 1
|
||||
return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).numberOfSectionsInTableView?(tableView) ?? 0
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue