Created
July 7, 2017 08:53
-
-
Save SunXiaoShan/a5117ff11f4b825280f3071951af8101 to your computer and use it in GitHub Desktop.
RAC_array_example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loop all element | |
NSArray *array = @[@"1", @"2", @"3", @"4", @"5"]; | |
[array.rac_sequence.signal subscribeNext:^(id _Nullable x) { | |
NSLog(@"element:%@", x); | |
}]; | |
// output | |
// element:1 | |
// element:2 | |
// element:3 | |
// element:4 | |
// element:5 | |
NSArray *array2 = @[@1, @2, @3, @4, @5]; | |
[[array2.rac_sequence.signal filter:^BOOL(id _Nullable value) { | |
return [value integerValue] > 2; | |
}] | |
subscribeNext:^(id _Nullable x) { | |
NSLog(@"element 2:%@", x); | |
}]; | |
// output | |
// element 2:3 | |
// element 2:4 | |
// element 2:5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment