RAC集合

作者: NextStepPeng | 来源:发表于2018-01-10 17:36 被阅读0次

    元组

      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];

    相关文章

      网友评论

          本文标题:RAC集合

          本文链接:https://www.haomeiwen.com/subject/cdaonxtx.html