diff --git a/Rx.xcodeproj/project.pbxproj b/Rx.xcodeproj/project.pbxproj index 5f51d1d3..f3a1760f 100644 --- a/Rx.xcodeproj/project.pbxproj +++ b/Rx.xcodeproj/project.pbxproj @@ -1460,7 +1460,7 @@ C8093C701B8A72BE0088E94D /* CombineLatest+arity.tt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "CombineLatest+arity.tt"; sourceTree = ""; }; C8093C711B8A72BE0088E94D /* CombineLatest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombineLatest.swift; sourceTree = ""; }; C8093C721B8A72BE0088E94D /* Concat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Concat.swift; sourceTree = ""; }; - C8093C741B8A72BE0088E94D /* ConnectableObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectableObservable.swift; sourceTree = ""; }; + C8093C741B8A72BE0088E94D /* ConnectableObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ConnectableObservable.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093C751B8A72BE0088E94D /* Debug.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debug.swift; sourceTree = ""; }; C8093C761B8A72BE0088E94D /* Deferred.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Deferred.swift; sourceTree = ""; }; C8093C771B8A72BE0088E94D /* DelaySubscription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelaySubscription.swift; sourceTree = ""; }; @@ -1508,7 +1508,7 @@ C8093CAF1B8A72BE0088E94D /* Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Rx.swift; sourceTree = ""; }; C8093CB01B8A72BE0088E94D /* RxMutableBox.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxMutableBox.swift; sourceTree = ""; }; C8093CB31B8A72BE0088E94D /* SchedulerType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulerType.swift; sourceTree = ""; }; - C8093CB51B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConcurrentDispatchQueueScheduler.swift; sourceTree = ""; }; + C8093CB51B8A72BE0088E94D /* ConcurrentDispatchQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ConcurrentDispatchQueueScheduler.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093CB71B8A72BE0088E94D /* MainScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainScheduler.swift; sourceTree = ""; }; C8093CB81B8A72BE0088E94D /* OperationQueueScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperationQueueScheduler.swift; sourceTree = ""; }; C8093CB91B8A72BE0088E94D /* RecursiveScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecursiveScheduler.swift; sourceTree = ""; }; @@ -1526,7 +1526,7 @@ C8093E861B8A732E0088E94D /* _RXKVOObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _RXKVOObserver.h; sourceTree = ""; }; C8093E871B8A732E0088E94D /* _RXKVOObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RXKVOObserver.m; sourceTree = ""; }; C8093E8A1B8A732E0088E94D /* CLLocationManager+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CLLocationManager+Rx.swift"; sourceTree = ""; }; - C8093E8B1B8A732E0088E94D /* DelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateProxy.swift; sourceTree = ""; }; + C8093E8B1B8A732E0088E94D /* DelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DelegateProxy.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8093E8C1B8A732E0088E94D /* DelegateProxyType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelegateProxyType.swift; sourceTree = ""; }; C8093E8D1B8A732E0088E94D /* Logging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logging.swift; sourceTree = ""; }; C8093E901B8A732E0088E94D /* ControlTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlTarget.swift; sourceTree = ""; }; @@ -1718,7 +1718,7 @@ C8C3DA051B9393AC004D233E /* Empty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Empty.swift; sourceTree = ""; }; C8C3DA081B93941E004D233E /* Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = ""; }; C8C3DA0B1B93959F004D233E /* Never.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Never.swift; sourceTree = ""; }; - C8C3DA0E1B939767004D233E /* CurrentThreadScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrentThreadScheduler.swift; sourceTree = ""; }; + C8C3DA0E1B939767004D233E /* CurrentThreadScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CurrentThreadScheduler.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8C3DA111B93A3EA004D233E /* AnonymousObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AnonymousObservable.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8C4B4A71C17722400828BD5 /* _RXObjCRuntime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _RXObjCRuntime.m; sourceTree = ""; }; C8C4B4A81C17722400828BD5 /* _RXObjCRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _RXObjCRuntime.h; sourceTree = ""; }; diff --git a/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift b/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift index 92b45734..634a5d18 100644 --- a/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift +++ b/RxCocoa/Common/CocoaUnits/UIBindingObserver.swift @@ -18,7 +18,7 @@ Observer that enforces interface binding rules: `UIBindingObserver` doesn't retain target interface and in case owned interface element is released, element isn't bound. */ -open class UIBindingObserver : ObserverType where UIElementType: AnyObject { +public class UIBindingObserver : ObserverType where UIElementType: AnyObject { public typealias E = Value weak var UIElement: UIElementType? @@ -36,7 +36,7 @@ open class UIBindingObserver : ObserverType where UIElemen /** Binds next element to owner view as described in `binding`. */ - open func on(_ event: Event) { + public func on(_ event: Event) { MainScheduler.ensureExecutingOnScheduler(errorMessage: "Element can be bound to user interface only on MainThread.") switch event { @@ -56,7 +56,7 @@ open class UIBindingObserver : ObserverType where UIElemen - returns: type erased observer. */ - open func asObserver() -> AnyObserver { + public func asObserver() -> AnyObserver { return AnyObserver(eventHandler: on) } } diff --git a/RxCocoa/Common/DelegateProxy.swift b/RxCocoa/Common/DelegateProxy.swift index 90df1bc1..d27a3f3a 100644 --- a/RxCocoa/Common/DelegateProxy.swift +++ b/RxCocoa/Common/DelegateProxy.swift @@ -85,7 +85,7 @@ open class DelegateProxy : _RXDelegateProxy { - parameter selector: Selector used to filter observed invocations of delegate methods. - returns: Observable sequence of arguments passed to `selector` method. */ - open func observe(_ selector: Selector) -> Observable<[AnyObject]> { + public func observe(_ selector: Selector) -> Observable<[AnyObject]> { if hasWiredImplementation(for: selector) { print("Delegate proxy is already implementing `\(selector)`, a more performant way of registering might exist.") } @@ -117,7 +117,7 @@ open class DelegateProxy : _RXDelegateProxy { - returns: Associated object tag. */ - open class func delegateAssociatedObjectTag() -> UnsafeRawPointer { + public class func delegateAssociatedObjectTag() -> UnsafeRawPointer { return _pointer(&delegateAssociatedTag) } @@ -126,7 +126,7 @@ open class DelegateProxy : _RXDelegateProxy { - returns: Initialized instance of `self`. */ - open class func createProxyForObject(_ object: AnyObject) -> AnyObject { + public class func createProxyForObject(_ object: AnyObject) -> AnyObject { return self.init(parentObject: object) } @@ -136,7 +136,7 @@ open class DelegateProxy : _RXDelegateProxy { - parameter object: Object that can have assigned delegate proxy. - returns: Assigned delegate proxy or `nil` if no delegate proxy is assigned. */ - open class func assignedProxyFor(_ object: AnyObject) -> AnyObject? { + public class func assignedProxyFor(_ object: AnyObject) -> AnyObject? { let maybeDelegate = objc_getAssociatedObject(object, self.delegateAssociatedObjectTag()) return castOptionalOrFatalError(maybeDelegate.map { $0 as AnyObject }) } @@ -147,7 +147,7 @@ open class DelegateProxy : _RXDelegateProxy { - parameter object: Object that can have assigned delegate proxy. - parameter proxy: Delegate proxy object to assign to `object`. */ - open class func assignProxy(_ proxy: AnyObject, toObject object: AnyObject) { + public class func assignProxy(_ proxy: AnyObject, toObject object: AnyObject) { precondition(proxy.isKind(of: self.classForCoder())) objc_setAssociatedObject(object, self.delegateAssociatedObjectTag(), proxy, .OBJC_ASSOCIATION_RETAIN) @@ -160,7 +160,7 @@ open class DelegateProxy : _RXDelegateProxy { - parameter forwardToDelegate: Reference of delegate that receives all messages through `self`. - parameter retainDelegate: Should `self` retain `forwardToDelegate`. */ - open func setForwardToDelegate(_ delegate: AnyObject?, retainDelegate: Bool) { + public func setForwardToDelegate(_ delegate: AnyObject?, retainDelegate: Bool) { self._setForward(toDelegate: delegate, retainDelegate: retainDelegate) } @@ -170,7 +170,7 @@ open class DelegateProxy : _RXDelegateProxy { - returns: Value of reference if set or nil. */ - open func forwardToDelegate() -> AnyObject? { + public func forwardToDelegate() -> AnyObject? { return self._forwardToDelegate } diff --git a/RxCocoa/Common/DelegateProxyType.swift b/RxCocoa/Common/DelegateProxyType.swift index bfcd54b1..b3d9ce63 100644 --- a/RxCocoa/Common/DelegateProxyType.swift +++ b/RxCocoa/Common/DelegateProxyType.swift @@ -191,6 +191,7 @@ extension DelegateProxyType { if currentDelegate !== proxy { proxy.setForwardToDelegate(currentDelegate, retainDelegate: false) + assert(proxy.forwardToDelegate() === currentDelegate) Self.setCurrentDelegate(proxy, toObject: object) assert(Self.currentDelegateFor(object) === proxy) assert(proxy.forwardToDelegate() === currentDelegate) @@ -226,7 +227,7 @@ extension DelegateProxyType { Self.setCurrentDelegate(nil, toObject: object) Self.setCurrentDelegate(proxy, toObject: object) - assert(proxy.forwardToDelegate() === forwardDelegate, "Setting of delegate failed") + assert(proxy.forwardToDelegate() === forwardDelegate, "Setting of delegate failed:\ncurrent:\n\(proxy.forwardToDelegate())\nexpected:\n\(forwardDelegate)") return Disposables.create { MainScheduler.ensureExecutingOnScheduler() diff --git a/RxCocoa/Common/_RXDelegateProxy.m b/RxCocoa/Common/_RXDelegateProxy.m index c82333a0..e5fe3335 100644 --- a/RxCocoa/Common/_RXDelegateProxy.m +++ b/RxCocoa/Common/_RXDelegateProxy.m @@ -10,7 +10,9 @@ #import "_RX.h" #import "_RXObjCRuntime.h" -@interface _RXDelegateProxy () +@interface _RXDelegateProxy () { + id __weak __forwardToDelegate; +} @property (nonatomic, strong) id strongForwardDelegate; @@ -90,6 +92,10 @@ static NSMutableDictionary *forwardableSelectorsPerClass = nil; } +-(id)_forwardToDelegate { + return __forwardToDelegate; +} + -(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate { __forwardToDelegate = forwardToDelegate; if (retainDelegate) { diff --git a/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift b/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift index 4798d59c..49380370 100644 --- a/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift +++ b/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift @@ -35,7 +35,7 @@ class CollectionViewDataSourceNotSet /** For more information take a look at `DelegateProxyType`. */ -open class RxCollectionViewDataSourceProxy +public class RxCollectionViewDataSourceProxy : DelegateProxy , UICollectionViewDataSource , DelegateProxyType { @@ -43,7 +43,7 @@ open class RxCollectionViewDataSourceProxy /** Typed parent object. */ - open weak private(set) var collectionView: UICollectionView? + public weak private(set) var collectionView: UICollectionView? private weak var _requiredMethodsDataSource: UICollectionViewDataSource? = collectionViewDataSourceNotSet @@ -62,14 +62,14 @@ open class RxCollectionViewDataSourceProxy /** Required delegate method implementation. */ - open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, numberOfItemsInSection: section) } /** Required delegate method implementation. */ - open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { return (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, cellForItemAt: indexPath) } @@ -78,7 +78,7 @@ open class RxCollectionViewDataSourceProxy /** For more information take a look at `DelegateProxyType`. */ - open override class func createProxyForObject(_ object: AnyObject) -> AnyObject { + public override class func createProxyForObject(_ object: AnyObject) -> AnyObject { let collectionView = (object as! UICollectionView) return castOrFatalError(collectionView.rx_createDataSourceProxy()) @@ -87,14 +87,14 @@ open class RxCollectionViewDataSourceProxy /** For more information take a look at `DelegateProxyType`. */ - open override class func delegateAssociatedObjectTag() -> UnsafeRawPointer { + public override class func delegateAssociatedObjectTag() -> UnsafeRawPointer { return _pointer(&dataSourceAssociatedTag) } /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let collectionView: UICollectionView = castOrFatalError(object) collectionView.dataSource = castOptionalOrFatalError(delegate) } @@ -102,7 +102,7 @@ open class RxCollectionViewDataSourceProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let collectionView: UICollectionView = castOrFatalError(object) return collectionView.dataSource } @@ -110,7 +110,7 @@ open class RxCollectionViewDataSourceProxy /** For more information take a look at `DelegateProxyType`. */ - open override func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) { + public override func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) { let requiredMethodsDataSource: UICollectionViewDataSource? = castOptionalOrFatalError(forwardToDelegate) _requiredMethodsDataSource = requiredMethodsDataSource ?? collectionViewDataSourceNotSet super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) diff --git a/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift index d1bd393e..b2c5933b 100644 --- a/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift @@ -17,7 +17,7 @@ import RxSwift /** For more information take a look at `DelegateProxyType`. */ -open class RxCollectionViewDelegateProxy +public class RxCollectionViewDelegateProxy : RxScrollViewDelegateProxy , UICollectionViewDelegate , UICollectionViewDelegateFlowLayout { @@ -25,7 +25,7 @@ open class RxCollectionViewDelegateProxy /** Typed parent object. */ - open weak private(set) var collectionView: UICollectionView? + public weak private(set) var collectionView: UICollectionView? /** Initializes `RxCollectionViewDelegateProxy` diff --git a/RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift index c6cdb710..91f0aaea 100644 --- a/RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxImagePickerDelegateProxy.swift @@ -14,7 +14,7 @@ #endif import UIKit -open class RxImagePickerDelegateProxy +public class RxImagePickerDelegateProxy : DelegateProxy , DelegateProxyType , UIImagePickerControllerDelegate @@ -23,7 +23,7 @@ open class RxImagePickerDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let imagePickerController: UIImagePickerController = castOrFatalError(object) imagePickerController.delegate = castOptionalOrFatalError(delegate) } @@ -31,7 +31,7 @@ open class RxImagePickerDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let imagePickerController: UIImagePickerController = castOrFatalError(object) return imagePickerController.delegate } diff --git a/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift index aefde483..29ed3978 100644 --- a/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift @@ -14,7 +14,7 @@ #endif import UIKit -open class RxPickerViewDelegateProxy +public class RxPickerViewDelegateProxy : DelegateProxy , DelegateProxyType , UIPickerViewDelegate { @@ -22,7 +22,7 @@ open class RxPickerViewDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let pickerView: UIPickerView = castOrFatalError(object) pickerView.delegate = castOptionalOrFatalError(delegate) } @@ -30,7 +30,7 @@ open class RxPickerViewDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let pickerView: UIPickerView = castOrFatalError(object) return pickerView.delegate } diff --git a/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift index 81d544a5..d4aad3ea 100644 --- a/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift @@ -17,7 +17,7 @@ import UIKit /** For more information take a look at `DelegateProxyType`. */ -open class RxScrollViewDelegateProxy +public class RxScrollViewDelegateProxy : DelegateProxy , UIScrollViewDelegate , DelegateProxyType { @@ -27,7 +27,7 @@ open class RxScrollViewDelegateProxy /** Typed parent object. */ - open weak fileprivate(set) var scrollView: UIScrollView? + public weak fileprivate(set) var scrollView: UIScrollView? /** Optimized version used for observing content offset changes. @@ -57,7 +57,7 @@ open class RxScrollViewDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open func scrollViewDidScroll(_ scrollView: UIScrollView) { + public func scrollViewDidScroll(_ scrollView: UIScrollView) { if let contentOffset = _contentOffsetSubject { contentOffset.on(.next(scrollView.contentOffset)) } @@ -69,7 +69,7 @@ open class RxScrollViewDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open override class func createProxyForObject(_ object: AnyObject) -> AnyObject { + public override class func createProxyForObject(_ object: AnyObject) -> AnyObject { let scrollView = (object as! UIScrollView) return castOrFatalError(scrollView.rx_createDelegateProxy()) @@ -78,7 +78,7 @@ open class RxScrollViewDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let scrollView: UIScrollView = castOrFatalError(object) scrollView.delegate = castOptionalOrFatalError(delegate) } @@ -86,7 +86,7 @@ open class RxScrollViewDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let scrollView: UIScrollView = castOrFatalError(object) return scrollView.delegate } diff --git a/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift index dd40dda6..330028b0 100644 --- a/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift @@ -17,7 +17,7 @@ import RxSwift /** For more information take a look at `DelegateProxyType`. */ -open class RxSearchBarDelegateProxy +public class RxSearchBarDelegateProxy : DelegateProxy , UISearchBarDelegate , DelegateProxyType { @@ -25,7 +25,7 @@ open class RxSearchBarDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let searchBar: UISearchBar = castOrFatalError(object) return searchBar.delegate } @@ -33,7 +33,7 @@ open class RxSearchBarDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let searchBar: UISearchBar = castOrFatalError(object) searchBar.delegate = castOptionalOrFatalError(delegate) } @@ -44,7 +44,7 @@ open class RxSearchBarDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open override class func createProxyForObject(_ object: AnyObject) -> AnyObject { + public override class func createProxyForObject(_ object: AnyObject) -> AnyObject { let searchBar = (object as! UISearchBar) return castOrFatalError(searchBar.rx_createDelegateProxy()) diff --git a/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift index 3f749222..2273fc2e 100644 --- a/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift @@ -18,7 +18,7 @@ For more information take a look at `DelegateProxyType`. */ @available(iOS 8.0, *) -open class RxSearchControllerDelegateProxy +public class RxSearchControllerDelegateProxy : DelegateProxy , DelegateProxyType , UISearchControllerDelegate { @@ -26,7 +26,7 @@ open class RxSearchControllerDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let searchController: UISearchController = castOrFatalError(object) searchController.delegate = castOptionalOrFatalError(delegate) } @@ -34,7 +34,7 @@ open class RxSearchControllerDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let searchController: UISearchController = castOrFatalError(object) return searchController.delegate } diff --git a/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift index 9ec8bd63..95103b41 100644 --- a/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift @@ -17,7 +17,7 @@ import RxSwift /** For more information take a look at `DelegateProxyType`. */ -open class RxTabBarDelegateProxy +public class RxTabBarDelegateProxy : DelegateProxy , UITabBarDelegate , DelegateProxyType { @@ -25,7 +25,7 @@ open class RxTabBarDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let tabBar: UITabBar = castOrFatalError(object) return tabBar.delegate } @@ -33,7 +33,7 @@ open class RxTabBarDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let tabBar: UITabBar = castOrFatalError(object) tabBar.delegate = castOptionalOrFatalError(delegate) } @@ -41,7 +41,7 @@ open class RxTabBarDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open override class func createProxyForObject(_ object: AnyObject) -> AnyObject { + public override class func createProxyForObject(_ object: AnyObject) -> AnyObject { let tabBar = (object as! UITabBar) return castOrFatalError(tabBar.rx_createDelegateProxy()) diff --git a/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift b/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift index 9a5f44d5..f54db564 100644 --- a/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift +++ b/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift @@ -32,7 +32,7 @@ class TableViewDataSourceNotSet /** For more information take a look at `DelegateProxyType`. */ -open class RxTableViewDataSourceProxy +public class RxTableViewDataSourceProxy : DelegateProxy , UITableViewDataSource , DelegateProxyType { @@ -40,7 +40,7 @@ open class RxTableViewDataSourceProxy /** Typed parent object. */ - open weak fileprivate(set) var tableView: UITableView? + public weak fileprivate(set) var tableView: UITableView? fileprivate weak var _requiredMethodsDataSource: UITableViewDataSource? = tableViewDataSourceNotSet @@ -59,14 +59,14 @@ open class RxTableViewDataSourceProxy /** Required delegate method implementation. */ - open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, numberOfRowsInSection: section) } /** Required delegate method implementation. */ - open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { return (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, cellForRowAt: indexPath) } @@ -75,7 +75,7 @@ open class RxTableViewDataSourceProxy /** For more information take a look at `DelegateProxyType`. */ - open override class func createProxyForObject(_ object: AnyObject) -> AnyObject { + public override class func createProxyForObject(_ object: AnyObject) -> AnyObject { let tableView = (object as! UITableView) return castOrFatalError(tableView.rx_createDataSourceProxy()) @@ -84,14 +84,14 @@ open class RxTableViewDataSourceProxy /** For more information take a look at `DelegateProxyType`. */ - open override class func delegateAssociatedObjectTag() -> UnsafeRawPointer { + public override class func delegateAssociatedObjectTag() -> UnsafeRawPointer { return _pointer(&dataSourceAssociatedTag) } /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let tableView: UITableView = castOrFatalError(object) tableView.dataSource = castOptionalOrFatalError(delegate) } @@ -99,7 +99,7 @@ open class RxTableViewDataSourceProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let tableView: UITableView = castOrFatalError(object) return tableView.dataSource } @@ -107,7 +107,7 @@ open class RxTableViewDataSourceProxy /** For more information take a look at `DelegateProxyType`. */ - open override func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) { + public override func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) { let requiredMethodsDataSource: UITableViewDataSource? = castOptionalOrFatalError(forwardToDelegate) _requiredMethodsDataSource = requiredMethodsDataSource ?? tableViewDataSourceNotSet super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate) diff --git a/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift index edeb3259..243f5850 100644 --- a/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift @@ -17,7 +17,7 @@ import RxSwift /** For more information take a look at `DelegateProxyType`. */ -open class RxTableViewDelegateProxy +public class RxTableViewDelegateProxy : RxScrollViewDelegateProxy , UITableViewDelegate { @@ -25,7 +25,7 @@ open class RxTableViewDelegateProxy /** Typed parent object. */ - open weak private(set) var tableView: UITableView? + public weak private(set) var tableView: UITableView? /** Initializes `RxTableViewDelegateProxy` diff --git a/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift index 62404244..d546d4cf 100644 --- a/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift @@ -14,7 +14,7 @@ #endif import UIKit -open class RxTextStorageDelegateProxy +public class RxTextStorageDelegateProxy : DelegateProxy , DelegateProxyType , NSTextStorageDelegate { @@ -23,7 +23,7 @@ open class RxTextStorageDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { + public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) { let textStorage: NSTextStorage = castOrFatalError(object) textStorage.delegate = castOptionalOrFatalError(delegate) } @@ -31,7 +31,7 @@ open class RxTextStorageDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - open class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { + public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? { let textStorage: NSTextStorage = castOrFatalError(object) return textStorage.delegate } diff --git a/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift b/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift index 239bb20f..3caf7bac 100644 --- a/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift +++ b/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift @@ -17,14 +17,14 @@ import RxSwift /** For more information take a look at `DelegateProxyType`. */ -open class RxTextViewDelegateProxy +public class RxTextViewDelegateProxy : RxScrollViewDelegateProxy , UITextViewDelegate { /** Typed parent object. */ - open weak private(set) var textView: UITextView? + public weak private(set) var textView: UITextView? /** Initializes `RxTextViewDelegateProxy` @@ -41,7 +41,7 @@ open class RxTextViewDelegateProxy /** For more information take a look at `DelegateProxyType`. */ - @objc open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + @objc public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { /** We've had some issues with observing text changes. This is here just in case we need the same hack in future and that we wouldn't need to change the public interface. diff --git a/RxSwift/Disposables/DisposeBase.swift b/RxSwift/Disposables/DisposeBase.swift index 941296dc..16da27ce 100644 --- a/RxSwift/Disposables/DisposeBase.swift +++ b/RxSwift/Disposables/DisposeBase.swift @@ -11,7 +11,7 @@ import Foundation /** Base class for all disposables. */ -open class DisposeBase { +public class DisposeBase { init() { #if TRACE_RESOURCES let _ = AtomicIncrement(&resourceCount) diff --git a/RxSwift/Disposables/SingleAssignmentDisposable.swift b/RxSwift/Disposables/SingleAssignmentDisposable.swift index bf0358e8..56f45d70 100644 --- a/RxSwift/Disposables/SingleAssignmentDisposable.swift +++ b/RxSwift/Disposables/SingleAssignmentDisposable.swift @@ -13,7 +13,7 @@ Represents a disposable resource which only allows a single assignment of its un If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an exception. */ -open class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable { +public class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable { private var _lock = SpinLock() // state @@ -24,7 +24,7 @@ open class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable { /** - returns: A value that indicates whether the object is disposed. */ - open var isDisposed: Bool { + public var isDisposed: Bool { return _isDisposed } @@ -40,7 +40,7 @@ open class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable { **Throws exception if the `SingleAssignmentDisposable` has already been assigned to.** */ - open var disposable: Disposable { + public var disposable: Disposable { get { _lock.lock(); defer { _lock.unlock() } return _disposable ?? Disposables.create() @@ -70,7 +70,7 @@ open class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable { /** Disposes the underlying disposable. */ - open func dispose() { + public func dispose() { if _isDisposed { return } diff --git a/RxSwift/Observable.swift b/RxSwift/Observable.swift index c3ad9ade..9c0f325b 100644 --- a/RxSwift/Observable.swift +++ b/RxSwift/Observable.swift @@ -13,7 +13,7 @@ A type-erased `ObservableType`. It represents a push style sequence. */ -open class Observable : ObservableType { +public class Observable : ObservableType { /** Type of elements in sequence. */ @@ -25,11 +25,11 @@ open class Observable : ObservableType { #endif } - open func subscribe(_ observer: O) -> Disposable where O.E == E { + public func subscribe(_ observer: O) -> Disposable where O.E == E { abstractMethod() } - open func asObservable() -> Observable { + public func asObservable() -> Observable { return self } diff --git a/RxSwift/Observables/Implementations/ConnectableObservable.swift b/RxSwift/Observables/Implementations/ConnectableObservable.swift index 8ec9bc47..db5611b5 100644 --- a/RxSwift/Observables/Implementations/ConnectableObservable.swift +++ b/RxSwift/Observables/Implementations/ConnectableObservable.swift @@ -11,7 +11,7 @@ import Foundation /** Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence. */ -open class ConnectableObservable +public class ConnectableObservable : Observable , ConnectableObservableType { @@ -20,7 +20,7 @@ open class ConnectableObservable - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence. */ - open func connect() -> Disposable { + public func connect() -> Disposable { abstractMethod() } } diff --git a/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift b/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift index 4250f7b1..56da6e0b 100644 --- a/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift +++ b/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift @@ -13,11 +13,11 @@ Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. This scheduler is suitable when some work needs to be performed in background. */ -open class ConcurrentDispatchQueueScheduler: SchedulerType { +public class ConcurrentDispatchQueueScheduler: SchedulerType { public typealias TimeInterval = Foundation.TimeInterval public typealias Time = Date - open var now : Date { + public var now : Date { return Date() } @@ -81,7 +81,7 @@ open class ConcurrentDispatchQueueScheduler: SchedulerType { - parameter action: Action to be executed. - returns: The disposable object used to cancel the scheduled action (best effort). */ - open func schedulePeriodic(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { + public func schedulePeriodic(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { return self.configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) } } diff --git a/RxSwift/Schedulers/CurrentThreadScheduler.swift b/RxSwift/Schedulers/CurrentThreadScheduler.swift index 43c0bb94..87936aa1 100644 --- a/RxSwift/Schedulers/CurrentThreadScheduler.swift +++ b/RxSwift/Schedulers/CurrentThreadScheduler.swift @@ -64,13 +64,13 @@ This is the default scheduler for operators that generate elements. This scheduler is also sometimes called `trampoline scheduler`. */ -open class CurrentThreadScheduler : ImmediateSchedulerType { +public class CurrentThreadScheduler : ImmediateSchedulerType { typealias ScheduleQueue = RxMutableBox> /** The singleton instance of the current thread scheduler. */ - open static let instance = CurrentThreadScheduler() + public static let instance = CurrentThreadScheduler() static var queue : ScheduleQueue? { get { @@ -84,7 +84,7 @@ open class CurrentThreadScheduler : ImmediateSchedulerType { /** Gets a value that indicates whether the caller must call a `schedule` method. */ - open static fileprivate(set) var isScheduleRequired: Bool { + public static fileprivate(set) var isScheduleRequired: Bool { get { let value: CurrentThreadSchedulerValue? = Thread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerKeyInstance as NSString) return value == nil @@ -104,7 +104,7 @@ open class CurrentThreadScheduler : ImmediateSchedulerType { - parameter action: Action to be executed. - returns: The disposable object used to cancel the scheduled action (best effort). */ - open func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { if CurrentThreadScheduler.isScheduleRequired { CurrentThreadScheduler.isScheduleRequired = false diff --git a/RxSwift/Schedulers/OperationQueueScheduler.swift b/RxSwift/Schedulers/OperationQueueScheduler.swift index 89b00d48..38d49220 100644 --- a/RxSwift/Schedulers/OperationQueueScheduler.swift +++ b/RxSwift/Schedulers/OperationQueueScheduler.swift @@ -13,8 +13,8 @@ Abstracts the work that needs to be performed on a specific `NSOperationQueue`. This scheduler is suitable for cases when there is some bigger chunk of work that needs to be performed in background and you want to fine tune concurrent processing using `maxConcurrentOperationCount`. */ -open class OperationQueueScheduler: ImmediateSchedulerType { - open let operationQueue: OperationQueue +public class OperationQueueScheduler: ImmediateSchedulerType { + public let operationQueue: OperationQueue /** Constructs new instance of `OperationQueueScheduler` that performs work on `operationQueue`. @@ -32,7 +32,7 @@ open class OperationQueueScheduler: ImmediateSchedulerType { - parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. - returns: The disposable object used to cancel the scheduled action (best effort). */ - open func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { let compositeDisposable = CompositeDisposable() diff --git a/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift b/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift index 203dc490..01733b01 100644 --- a/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift +++ b/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift @@ -25,14 +25,14 @@ In case some customization need to be made on it before usage, internal serial queue can be customized using `serialQueueConfiguration` callback. */ -open class SerialDispatchQueueScheduler : SchedulerType { +public class SerialDispatchQueueScheduler : SchedulerType { public typealias TimeInterval = Foundation.TimeInterval public typealias Time = Date /** - returns: Current time. */ - open var now : Date { + public var now : Date { return Date() } @@ -118,7 +118,7 @@ open class SerialDispatchQueueScheduler : SchedulerType { - parameter action: Action to be executed. - returns: The disposable object used to cancel the scheduled action (best effort). */ - open func schedulePeriodic(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { + public func schedulePeriodic(_ state: StateType, startAfter: TimeInterval, period: TimeInterval, action: @escaping (StateType) -> StateType) -> Disposable { return self.configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action) } } diff --git a/RxSwift/Schedulers/VirtualTimeScheduler.swift b/RxSwift/Schedulers/VirtualTimeScheduler.swift index 5cd01001..63cf2742 100644 --- a/RxSwift/Schedulers/VirtualTimeScheduler.swift +++ b/RxSwift/Schedulers/VirtualTimeScheduler.swift @@ -30,14 +30,14 @@ open class VirtualTimeScheduler /** - returns: Current time. */ - open var now: RxTime { + public var now: RxTime { return _converter.convertFromVirtualTime(clock) } /** - returns: Scheduler's absolute time clock value. */ - open var clock: VirtualTime { + public var clock: VirtualTime { return _clock } @@ -72,7 +72,7 @@ open class VirtualTimeScheduler - parameter action: Action to be executed. - returns: The disposable object used to cancel the scheduled action (best effort). */ - open func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { + public func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { return self.scheduleRelative(state, dueTime: 0.0) { a in return action(a) } @@ -86,7 +86,7 @@ open class VirtualTimeScheduler - parameter action: Action to be executed. - returns: The disposable object used to cancel the scheduled action (best effort). */ - open func scheduleRelative(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { + public func scheduleRelative(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { let time = self.now.addingTimeInterval(dueTime) let absoluteTime = _converter.convertToVirtualTime(time) let adjustedTime = self.adjustScheduledTime(absoluteTime) @@ -101,7 +101,7 @@ open class VirtualTimeScheduler - parameter action: Action to be executed. - returns: The disposable object used to cancel the scheduled action (best effort). */ - open func scheduleRelativeVirtual(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { + public func scheduleRelativeVirtual(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable { let time = _converter.offsetVirtualTime(self.clock, offset: dueTime) return scheduleAbsoluteVirtual(state, time: time, action: action) } @@ -114,7 +114,7 @@ open class VirtualTimeScheduler - parameter action: Action to be executed. - returns: The disposable object used to cancel the scheduled action (best effort). */ - open func scheduleAbsoluteVirtual(_ state: StateType, time: Converter.VirtualTimeUnit, action: @escaping (StateType) -> Disposable) -> Disposable { + public func scheduleAbsoluteVirtual(_ state: StateType, time: Converter.VirtualTimeUnit, action: @escaping (StateType) -> Disposable) -> Disposable { MainScheduler.ensureExecutingOnScheduler() let compositeDisposable = CompositeDisposable() @@ -143,7 +143,7 @@ open class VirtualTimeScheduler /** Starts the virtual time scheduler. */ - open func start() { + public func start() { MainScheduler.ensureExecutingOnScheduler() if _running { @@ -185,7 +185,7 @@ open class VirtualTimeScheduler - parameter virtualTime: Absolute time to advance the scheduler's clock to. */ - open func advanceTo(_ virtualTime: VirtualTime) { + public func advanceTo(_ virtualTime: VirtualTime) { MainScheduler.ensureExecutingOnScheduler() if _running { @@ -217,7 +217,7 @@ open class VirtualTimeScheduler /** Advances the scheduler's clock by the specified relative time. */ - open func sleep(_ virtualInterval: VirtualTimeInterval) { + public func sleep(_ virtualInterval: VirtualTimeInterval) { MainScheduler.ensureExecutingOnScheduler() let sleepTo = _converter.offsetVirtualTime(clock, offset: virtualInterval) @@ -231,7 +231,7 @@ open class VirtualTimeScheduler /** Stops the virtual time scheduler. */ - open func stop() { + public func stop() { MainScheduler.ensureExecutingOnScheduler() _running = false diff --git a/RxSwift/Subjects/ReplaySubject.swift b/RxSwift/Subjects/ReplaySubject.swift index 63f31c8f..d8c160c7 100644 --- a/RxSwift/Subjects/ReplaySubject.swift +++ b/RxSwift/Subjects/ReplaySubject.swift @@ -13,7 +13,7 @@ Represents an object that is both an observable sequence as well as an observer. Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies. */ -open class ReplaySubject +public class ReplaySubject : Observable , SubjectType , ObserverType @@ -23,7 +23,7 @@ open class ReplaySubject /** Indicates whether the subject has any observers */ - open var hasObservers: Bool { + public var hasObservers: Bool { _lock.lock(); defer { _lock.unlock() } return _observers.count > 0 } @@ -46,21 +46,21 @@ open class ReplaySubject - parameter event: Event to send to the observers. */ - open func on(_ event: Event) { + public func on(_ event: Event) { abstractMethod() } /** Returns observer interface for subject. */ - open func asObserver() -> SubjectObserverType { + public func asObserver() -> SubjectObserverType { return self } /** Unsubscribe all observers and release resources. */ - open func dispose() { + public func dispose() { } /** @@ -69,7 +69,7 @@ open class ReplaySubject - parameter bufferSize: Maximal number of elements to replay to observer after subscription. - returns: New instance of replay subject. */ - open static func create(bufferSize: Int) -> ReplaySubject { + public static func create(bufferSize: Int) -> ReplaySubject { if bufferSize == 1 { return ReplayOne() } @@ -83,7 +83,7 @@ open class ReplaySubject To avoid filling up memory, developer needs to make sure that the use case will only ever store a 'reasonable' number of elements. */ - open static func createUnbounded() -> ReplaySubject { + public static func createUnbounded() -> ReplaySubject { return ReplayAll() } } diff --git a/RxSwift/Subjects/Variable.swift b/RxSwift/Subjects/Variable.swift index 7122f4a0..77137c1d 100644 --- a/RxSwift/Subjects/Variable.swift +++ b/RxSwift/Subjects/Variable.swift @@ -14,7 +14,7 @@ Variable is a wrapper for `BehaviorSubject`. Unlike `BehaviorSubject` it can't terminate with error, and when variable is deallocated it will complete it's observable sequence (`asObservable`). */ -open class Variable { +public class Variable { public typealias E = Element @@ -32,7 +32,7 @@ open class Variable { Even if the newly set value is same as the old value, observers are still notified for change. */ - open var value: E { + public var value: E { get { _lock.lock(); defer { _lock.unlock() } return _value @@ -59,7 +59,7 @@ open class Variable { /** - returns: Canonical interface for push style sequence */ - open func asObservable() -> Observable { + public func asObservable() -> Observable { return _subject } diff --git a/RxTests/Schedulers/TestScheduler.swift b/RxTests/Schedulers/TestScheduler.swift index 2c9aae60..02ea2a6e 100644 --- a/RxTests/Schedulers/TestScheduler.swift +++ b/RxTests/Schedulers/TestScheduler.swift @@ -12,7 +12,7 @@ import RxSwift /** Virtual time scheduler used for testing applications and libraries built using RxSwift. */ -open class TestScheduler : VirtualTimeScheduler { +public class TestScheduler : VirtualTimeScheduler { /** Default values of scheduler times. */ @@ -52,7 +52,7 @@ open class TestScheduler : VirtualTimeScheduler(_ events: [Recorded>]) -> TestableObservable { + public func createHotObservable(_ events: [Recorded>]) -> TestableObservable { return HotObservable(testScheduler: self as AnyObject as! TestScheduler, recordedEvents: events) } @@ -62,7 +62,7 @@ open class TestScheduler : VirtualTimeScheduler(_ events: [Recorded>]) -> TestableObservable { + public func createColdObservable(_ events: [Recorded>]) -> TestableObservable { return ColdObservable(testScheduler: self as AnyObject as! TestScheduler, recordedEvents: events) } @@ -72,7 +72,7 @@ open class TestScheduler : VirtualTimeScheduler(_ type: E.Type) -> TestableObserver { + public func createObserver(_ type: E.Type) -> TestableObserver { return TestableObserver(scheduler: self as AnyObject as! TestScheduler) } @@ -81,7 +81,7 @@ open class TestScheduler : VirtualTimeScheduler Void) { + public func scheduleAt(_ time: TestTime, action: @escaping () -> Void) { _ = self.scheduleAbsoluteVirtual((), time: time, action: { () -> Disposable in action() return Disposables.create() @@ -91,7 +91,7 @@ open class TestScheduler : VirtualTimeScheduler VirtualTime { + override public func adjustScheduledTime(_ time: VirtualTime) -> VirtualTime { return time <= clock ? clock + (_simulateProcessingDelay ? 1 : 0) : time } @@ -104,7 +104,7 @@ open class TestScheduler : VirtualTimeScheduler(_ created: TestTime, subscribed: TestTime, disposed: TestTime, create: @escaping () -> Observable) -> TestableObserver { + public func start(_ created: TestTime, subscribed: TestTime, disposed: TestTime, create: @escaping () -> Observable) -> TestableObserver { var source : Observable? = nil var subscription : Disposable? = nil let observer = createObserver(Element.self) @@ -140,7 +140,7 @@ open class TestScheduler : VirtualTimeScheduler(_ disposed: TestTime, create: @escaping () -> Observable) -> TestableObserver { + public func start(_ disposed: TestTime, create: @escaping () -> Observable) -> TestableObserver { return start(Defaults.created, subscribed: Defaults.subscribed, disposed: disposed, create: create) } @@ -155,7 +155,7 @@ open class TestScheduler : VirtualTimeScheduler(_ create: @escaping () -> Observable) -> TestableObserver { + public func start(_ create: @escaping () -> Observable) -> TestableObserver { return start(Defaults.created, subscribed: Defaults.subscribed, disposed: Defaults.disposed, create: create) } } diff --git a/RxTests/TestableObservable.swift b/RxTests/TestableObservable.swift index bafe75e9..2282c127 100644 --- a/RxTests/TestableObservable.swift +++ b/RxTests/TestableObservable.swift @@ -12,20 +12,20 @@ import RxSwift /** Observable sequence that records subscription lifetimes and timestamped events sent to observers. */ -open class TestableObservable +public class TestableObservable : ObservableType { public typealias E = Element /** Subscriptions recorded during observable lifetime. */ - open internal(set) var subscriptions: [Subscription] + public internal(set) var subscriptions: [Subscription] /** List of events to replay for all subscribers. Event times represent absolute `TestScheduler` time. */ - open internal(set) var recordedEvents: [Recorded>] + public internal(set) var recordedEvents: [Recorded>] /** Parent test scheduler. @@ -38,7 +38,7 @@ open class TestableObservable self.subscriptions = [] } - open func subscribe(_ observer: O) -> Disposable where O.E == Element { + public func subscribe(_ observer: O) -> Disposable where O.E == Element { fatalError("Abstract method") } } diff --git a/RxTests/TestableObserver.swift b/RxTests/TestableObserver.swift index 1d5fedf9..dd349f7e 100644 --- a/RxTests/TestableObserver.swift +++ b/RxTests/TestableObserver.swift @@ -12,7 +12,7 @@ import RxSwift /** Observer that records events together with virtual time when they were received. */ -open class TestableObserver +public class TestableObserver : ObserverType { public typealias Element = ElementType @@ -21,7 +21,7 @@ open class TestableObserver /** Recorded events. */ - open fileprivate(set) var events = [Recorded>]() + public fileprivate(set) var events = [Recorded>]() init(scheduler: TestScheduler) { _scheduler = scheduler @@ -32,7 +32,7 @@ open class TestableObserver - parameter event: Event that occured. */ - open func on(_ event: Event) { + public func on(_ event: Event) { events.append(Recorded(time: _scheduler.clock, event: event)) } }