diff --git a/Documentation/Schedulers.md b/Documentation/Schedulers.md index 6dbe7cc3..331f5e39 100644 --- a/Documentation/Schedulers.md +++ b/Documentation/Schedulers.md @@ -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. -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. diff --git a/RxCocoa/Common/DelegateProxyType.swift b/RxCocoa/Common/DelegateProxyType.swift index eded49a1..f41782a6 100644 --- a/RxCocoa/Common/DelegateProxyType.swift +++ b/RxCocoa/Common/DelegateProxyType.swift @@ -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) diff --git a/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift b/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift index 452a14c6..e34c20db 100644 --- a/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift +++ b/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift @@ -19,8 +19,10 @@ let collectionViewDataSourceNotSet = CollectionViewDataSourceNotSet() class CollectionViewDataSourceNotSet : NSObject , UICollectionViewDataSource { + + 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: diff --git a/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift b/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift index 75e8033a..558008ea 100644 --- a/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift +++ b/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift @@ -19,8 +19,9 @@ let tableViewDataSourceNotSet = TableViewDataSourceNotSet() class TableViewDataSourceNotSet : NSObject , UITableViewDataSource { - func numberOfSections(in tableView: UITableView) -> Int { - rxAbstractMethodWithMessage(dataSourceNotSet) + + func numberOfSectionsInTableView(tableView: UITableView) -> Int { + return 0 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { @@ -62,8 +63,8 @@ public class RxTableViewDataSourceProxy /** Required delegate method implementation. */ - public func numberOfSections(in tableView: UITableView) -> Int { - return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).numberOfSections?(in: tableView) ?? 1 + public func numberOfSectionsInTableView(tableView: UITableView) -> Int { + return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).numberOfSections?(in: tableView) ?? 0 } /**