-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lightweight generics to RACChannel and RACChannelTerminal. #88
Conversation
Both of them now have exactly one associated value (a covariant).
ReactiveObjC/RACChannel.h
Outdated
@@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
/// terminals. | |||
/// | |||
/// Do not instantiate this class directly. Create a RACChannel instead. | |||
@interface RACChannelTerminal : RACSignal <RACSubscriber> | |||
@interface RACChannelTerminal<__covariant ValueType> : RACSignal <RACSubscriber> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't a <ValueType>
annotation required after RACSignal
here, e.g.:
RACChannelTerminal<__covariant ValueType> : RACSignal<ValueType>`
ReactiveObjC/RACChannel.h
Outdated
@@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
/// terminals. | |||
/// | |||
/// Do not instantiate this class directly. Create a RACChannel instead. | |||
@interface RACChannelTerminal : RACSignal <RACSubscriber> | |||
@interface RACChannelTerminal<__covariant ValueType> : RACSignal <RACSubscriber> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does sendNext:
need to be redeclared here with ValueType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. Fixed here as for RACSubject
.
ReactiveObjC/RACChannel.h
Outdated
@@ -31,22 +31,22 @@ NS_ASSUME_NONNULL_BEGIN | |||
/// on the `followingTerminal`, and received in the model from the | |||
/// `leadingTerminal`. However, the initial value of the view is not received | |||
/// from the `leadingTerminal` (only future changes). | |||
@interface RACChannel : NSObject | |||
@interface RACChannel<__covariant ValueType> : NSObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't RACChannel
invariant since it is a sink and source of values?
ReactiveObjC/RACChannel.h
Outdated
@@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
/// terminals. | |||
/// | |||
/// Do not instantiate this class directly. Create a RACChannel instead. | |||
@interface RACChannelTerminal : RACSignal <RACSubscriber> | |||
@interface RACChannelTerminal<__covariant ValueType> : RACSignal <RACSubscriber> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't RACChannelTerminal
invariant since it is a sink and source of values?
ReactiveObjC/RACChannel.m
Outdated
@@ -11,15 +11,15 @@ | |||
#import "RACReplaySubject.h" | |||
#import "RACSignal+Operations.h" | |||
|
|||
@interface RACChannelTerminal () | |||
@interface RACChannelTerminal<__covariant ValueType> () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't RACChannelTerminal
invariant since it is a sink and source of values?
@@ -8,7 +8,7 @@ | |||
|
|||
#import <UIKit/UIKit.h> | |||
|
|||
@class RACChannelTerminal; | |||
@class RACChannelTerminal<__covariant ValueType>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't RACChannelTerminal
invariant since it is a sink and source of values?
@@ -8,7 +8,7 @@ | |||
|
|||
#import <UIKit/UIKit.h> | |||
|
|||
@class RACChannelTerminal; | |||
@class RACChannelTerminal<__covariant ValueType>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't RACChannelTerminal
invariant since it is a sink and source of values?
@@ -8,7 +8,7 @@ | |||
|
|||
#import <UIKit/UIKit.h> | |||
|
|||
@class RACChannelTerminal; | |||
@class RACChannelTerminal<__covariant ValueType>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't RACChannelTerminal
invariant since it is a sink and source of values?
@@ -27,3 +29,5 @@ | |||
- (RACChannelTerminal *)rac_channelForControlEvents:(UIControlEvents)controlEvents key:(NSString *)key nilValue:(id)nilValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't nilValue
nullable? e.g. - (RACChannelTerminal *)rac_newSelectedSegmentIndexChannelWithNilValue:(nullable NSNumber *)nilValue;
calls through to this with a nullable value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Fixed and added a clarifying sentence to the method documentation.
ReactiveObjC/RACChannel.h
Outdated
@@ -9,7 +9,7 @@ | |||
#import "RACSignal.h" | |||
#import "RACSubscriber.h" | |||
|
|||
@class RACChannelTerminal; | |||
@class RACChannelTerminal<__covariant ValueType>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't RACChannelTerminal
invariant since it is a sink and source of values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course! Fixed, here and elsewhere.
…generic type. Because they are both a source and a sink, they oughn’t to have covariant generics.
For RACChannelTerminal.
It's possible that one wants to have nil values actually be nil, so annotate the argument accordingly.
…ocumentation comment.
@erichoracek Thanks for the comments; I've addressed all of them, so feel free to have another look whenever you have time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🎉
Includes ReactiveCocoa#75, ReactiveCocoa#80, ReactiveCocoa#81, ReactiveCocoa#82, ReactiveCocoa#83, ReactiveCocoa#85, ReactiveCocoa#87, and ReactiveCocoa#88. As far as I can tell, this should have no breaking changes.
Includes ReactiveCocoa#75, ReactiveCocoa#80, ReactiveCocoa#81, ReactiveCocoa#82, ReactiveCocoa#83, ReactiveCocoa#85, ReactiveCocoa#87, and ReactiveCocoa#88. While this has no breaking changes in Obj-C, it will likely introduce breaking changes in Swift.
Add lightweight generics to RACChannel and RACChannelTerminal.
Includes ReactiveCocoa#75, ReactiveCocoa#80, ReactiveCocoa#81, ReactiveCocoa#82, ReactiveCocoa#83, ReactiveCocoa#85, ReactiveCocoa#87, and ReactiveCocoa#88. While this has no breaking changes in Obj-C, it will likely introduce breaking changes in Swift.
Both of them now have exactly one associated value (a covariant).