File tree Expand file tree Collapse file tree 9 files changed +17
-17
lines changed Expand file tree Collapse file tree 9 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,14 @@ extension Signal: StreamType {
1212 public typealias ValueType = T
1313 public typealias DisposableType = DisposableWrapper<T>
1414
15- public func subscribe (_ function : @escaping (T) -> Void ) -> DisposableWrapper<T>? {
15+ public func subscribe (_ function : @escaping (T) -> Void ) -> DisposableWrapper<T> {
1616 return DisposableWrapper (disposable : subscribeValues (handler : function))
1717 }
1818}
1919
2020public struct DisposableWrapper <T >: SubscriptionReferenceType {
2121 let disposable: SignalEndpoint<T>
22-
22+
2323 public func dispose () {
2424 disposable.cancel ()
2525 }
Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ extension Promise: StreamType {
99 public typealias ValueType = T
1010 public typealias DisposableType = DisposableFake
1111
12- public func subscribe (_ function : @escaping (T) -> Void ) -> DisposableFake? {
12+ public func subscribe (_ function : @escaping (T) -> Void ) -> DisposableFake {
1313 _ = self .then (execute : function)
14- return nil
14+ return . init ()
1515 }
1616}
1717
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ import ReactiveReSwift
1111extension Signal : StreamType {
1212 public typealias ValueType = Element
1313 public typealias DisposableType = DisposableWrapper
14-
15- public func subscribe (_ function : @escaping (Element ) -> Void ) -> DisposableWrapper? {
14+
15+ public func subscribe (_ function : @escaping (Element ) -> Void ) -> DisposableWrapper {
1616 return DisposableWrapper (disposable : self .observeNext (with : function))
1717 }
1818}
@@ -21,14 +21,14 @@ extension Property: ObservablePropertyType {
2121 public typealias ValueType = Value
2222 public typealias DisposableType = DisposableWrapper
2323
24- public func subscribe (_ function : @escaping (Value ) -> Void ) -> DisposableWrapper? {
24+ public func subscribe (_ function : @escaping (Value ) -> Void ) -> DisposableWrapper {
2525 return DisposableWrapper (disposable : observeNext (with : function))
2626 }
2727}
2828
2929public struct DisposableWrapper : SubscriptionReferenceType {
3030 let disposable: Disposable
31-
31+
3232 public func dispose () {
3333 disposable.dispose ()
3434 }
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ extension SignalProducer: StreamType {
3939 public typealias DisposableType = AnyDisposable
4040
4141 @discardableResult
42- public func subscribe (_ function : @escaping (Value ) -> Void ) -> AnyDisposable? {
42+ public func subscribe (_ function : @escaping (Value ) -> Void ) -> AnyDisposable {
4343 return AnyDisposable (self .on (value : function).start ())
4444 }
4545}
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ extension Variable: ObservablePropertyType {
1212 public typealias ValueType = Element
1313 public typealias DisposableType = DisposableWrapper
1414
15- public func subscribe (_ function : @escaping (Element ) -> Void ) -> DisposableWrapper? {
15+ public func subscribe (_ function : @escaping (Element ) -> Void ) -> DisposableWrapper {
1616 return DisposableWrapper (disposable : asObservable ().subscribe (onNext : function))
1717 }
1818}
@@ -21,7 +21,7 @@ extension Observable: StreamType {
2121 public typealias ValueType = Element
2222 public typealias DisposableType = DisposableWrapper
2323
24- public func subscribe (_ function : @escaping (Element ) -> Void ) -> DisposableWrapper? {
24+ public func subscribe (_ function : @escaping (Element ) -> Void ) -> DisposableWrapper {
2525 return DisposableWrapper (disposable : subscribe (onNext : function))
2626 }
2727}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ open class Store<ObservableProperty: ObservablePropertyType> {
3636 }
3737
3838 @discardableResult
39- public func dispatch< S: StreamType > ( _ stream: S ) -> SubscriptionReferenceType ? where S. ValueType: Action {
39+ public func dispatch< S: StreamType > ( _ stream: S ) -> SubscriptionReferenceType where S. ValueType: Action {
4040 let disposable = stream. subscribe { [ unowned self] action in
4141 self . dispatch ( action)
4242 }
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public class ObservableProperty<ValueType>: ObservablePropertyType {
3333 }
3434
3535 @discardableResult
36- public func subscribe( _ function: @escaping ( ValueType ) -> Void ) -> DisposableType ? {
36+ public func subscribe( _ function: @escaping ( ValueType ) -> Void ) -> DisposableType {
3737 defer { subscriptionToken += 1 }
3838 retainReference = self
3939 function ( value)
Original file line number Diff line number Diff line change @@ -19,5 +19,5 @@ public protocol StreamType {
1919 associatedtype DisposableType : SubscriptionReferenceType
2020
2121 /// Register a callback to be called when new values flow down the stream.
22- func subscribe( _ function: @escaping ( ValueType ) -> Void ) -> DisposableType ?
22+ func subscribe( _ function: @escaping ( ValueType ) -> Void ) -> DisposableType
2323}
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ class ReactiveTests: XCTestCase {
5757 let property = ObservableProperty ( ( ) )
5858 let reference = property. subscribe ( { } )
5959 XCTAssertEqual ( property. subscriptions. count, 1 )
60- reference? . dispose ( )
60+ reference. dispose ( )
6161 XCTAssertEqual ( property. subscriptions. count, 0 )
6262 }
6363
@@ -73,7 +73,7 @@ class ReactiveTests: XCTestCase {
7373 func testThatDisposingOfAReferenceTwiceIsOkay( ) {
7474 let property = ObservableProperty ( ( ) )
7575 let reference = property. subscribe ( { } )
76- reference? . dispose ( )
77- reference? . dispose ( )
76+ reference. dispose ( )
77+ reference. dispose ( )
7878 }
7979}
You can’t perform that action at this time.
0 commit comments