RAC集合

2018-01-10  本文已影响0人  NextStepPeng

元组

  RACTuple *tuple =  [RACTuple tupleWithObjectsFromArray:@[@"AAA",@"AAA",@"AAA"]];
    NSString *str = tuple[0];
    NSLog(@"%@",str);//AAA

RACSequence

NSArray

NSArray *arr = @[@"122",@"233",@"333"];

    RACSequence * sequence = arr.rac_sequence;

    RACSignal *signal =  sequence.signal;

    //订阅信号

    [signal subscribeNext:^(id  _Nullable x) {

        NSLog(@"%@",x);

    }];

NSDictionary

    NSDictionary *dic = @{@"1":@"yi",@"2":@"er"};
   
    [dic.rac_sequence.signal subscribeNext:^(RACTuple * x) {
        RACTupleUnpack(NSString *key,NSString *value) = x;
       
        NSLog(@"key:%@,value:%@",key,value);
    }];

//NSArray 结合NSDictionary 和模型

NSArray *dicArray = @[@{@"1":@"yi",@"2":@"er"},@{@"1":@"yi",@"2":@"er"},@{@"1":@"yi",@"2":@"er"}];

   NSArray *array =[ [dicArray.rac_sequence map:^id _Nullable(NSDictionary * value) {

        return  [Model modelWithDic:value];

    }] array];

上一篇下一篇

猜你喜欢

热点阅读