RACSignal 信号类
- rac 主要是用过类别的形式引进去方法与属性,返回类型全部是RACSignal 信号类,因此,RACSignal 类是最为核心的类。
RACSignal 里面的属性与方法:
@interface RACSignal<__covariant ValueType> : RACStream
1. + (RACSignal<ValueType> *)createSignal:(RACDisposable * _Nullable (^)(id<RACSubscriber> subscriber))didSubscribe;
2. + (RACSignal<ValueType> *)error:(nullable NSError *)error;
3. + (RACSignal<ValueType> *)never;
4. + (RACSignal<ValueType> *)startEagerlyWithScheduler:(RACScheduler *)scheduler block:(void (^)(id<RACSubscriber> subscriber))block;
5. + (RACSignal<ValueType> *)startLazilyWithScheduler:(RACScheduler *)scheduler block:(void (^)(id<RACSubscriber> subscriber))block RAC_WARN_UNUSED_RESULT;
@end
@interface RACSignal<__covariant ValueType> (RACStream) //类别
1. + (RACSignal<ValueType> *)return:(nullable ValueType)value;
2. + (RACSignal<ValueType> *)empty;
3. typedef RACSignal * _Nullable (^RACSignalBindBlock)(ValueType _Nullable value, BOOL *stop);
4. - (RACSignal *)bind:(RACSignalBindBlock (^)(void))block;
5. - (RACSignal *)concat:(RACSignal *)signal;
6. - (RACSignal<RACTwoTuple<ValueType, id> *> *)zipWith:(RACSignal *)signal;
@end
@interface RACSignal<__covariant ValueType> (RACStreamOperations) //类别
1. - (RACSignal *)flattenMap:(__kindof RACSignal * _Nullable (^)(ValueType _Nullable value))block;
2. - (RACSignal *)flatten;
3. - (RACSignal *)map:(id _Nullable (^)(ValueType _Nullable value))block;
4. - (RACSignal *)mapReplace:(nullable id)object;
5. - (RACSignal<ValueType> *)filter:(BOOL (^)(ValueType _Nullable value))block;
6. - (RACSignal<ValueType> *)ignore:(nullable ValueType)value;
7. - (RACSignal *)reduceEach:(id _Nullable (^)())reduceBlock;
8. - (RACSignal<ValueType> *)startWith:(nullable ValueType)value;
9. - (RACSignal<ValueType> *)skip:(NSUInteger)skipCount;
10. - (RACSignal<ValueType> *)take:(NSUInteger)count;
11. + (RACSignal<RACTuple *> *)zip:(id<NSFastEnumeration>)signals;
11. + (RACSignal<ValueType> *)zip:(id<NSFastEnumeration>)signals reduce:(id _Nullable (^)())reduceBlock;
12. + (RACSignal<ValueType> *)concat:(id<NSFastEnumeration>)signals;
13. - (RACSignal *)scanWithStart:(nullable id)startingValue reduce:(id _Nullable (^)(id _Nullable running, ValueType _Nullable next))reduceBlock;
14. - (RACSignal *)scanWithStart:(nullable id)startingValue reduceWithIndex:(id _Nullable (^)(id _Nullable running, ValueType _Nullable next, NSUInteger index))reduceBlock;
15. - (RACSignal *)combinePreviousWithStart:(nullable ValueType)start reduce:(id _Nullable (^)(ValueType _Nullable previous, ValueType _Nullable current))reduceBlock;
16. - (RACSignal<ValueType> *)takeUntilBlock:(BOOL (^)(ValueType _Nullable x))predicate;
17. - (RACSignal<ValueType> *)takeWhileBlock:(BOOL (^)(ValueType _Nullable x))predicate;
18. - (RACSignal<ValueType> *)skipUntilBlock:(BOOL (^)(ValueType _Nullable x))predicate;
19. - (RACSignal<ValueType> *)skipWhileBlock:(BOOL (^)(ValueType _Nullable x))predicate;
20. - (RACSignal<ValueType> *)distinctUntilChanged;
@end
@interface RACSignal<__covariant ValueType> (Subscription) //类别
1. - (RACDisposable *)subscribe:(id<RACSubscriber>)subscriber;
2. - (RACDisposable *)subscribeNext:(void (^)(ValueType _Nullable x))nextBlock;
3. - (RACDisposable *)subscribeNext:(void (^)(ValueType _Nullable x))nextBlock completed:(void (^)(void))completedBlock;
4. - (RACDisposable *)subscribeNext:(void (^)(ValueType _Nullable x))nextBlock error:(void (^)(NSError * _Nullable error))errorBlock completed:(void (^)(void))completedBlock;
5. - (RACDisposable *)subscribeError:(void (^)(NSError * _Nullable error))errorBlock;
6. - (RACDisposable *)subscribeCompleted:(void (^)(void))completedBlock;
7. - (RACDisposable *)subscribeNext:(void (^)(ValueType _Nullable x))nextBlock error:(void (^)(NSError * _Nullable error))errorBlock;
8. - (RACDisposable *)subscribeError:(void (^)(NSError * _Nullable error))errorBlock completed:(void (^)(void))completedBlock;
@end
@interface RACSignal<__covariant ValueType> (Debugging)
1. - (RACSignal<ValueType> *)logAll;
2. - (RACSignal<ValueType> *)logNext;
3. - (RACSignal<ValueType> *)logError;
4. - (RACSignal<ValueType> *)logCompleted;
@end
@interface RACSignal<__covariant ValueType> (Testing)
1. - (nullable ValueType)asynchronousFirstOrDefault:(nullable ValueType)defaultValue success:(nullable BOOL *)success error:(NSError * _Nullable * _Nullable)error;
2. - (BOOL)asynchronouslyWaitUntilCompleted:(NSError * _Nullable * _Nullable)error;
@end