https://github.com/maxgoedjen/nsarray-comprehension
Python-like array comprehensions for Objective-C
https://github.com/maxgoedjen/nsarray-comprehension
Last synced: 29 days ago
JSON representation
Python-like array comprehensions for Objective-C
- Host: GitHub
- URL: https://github.com/maxgoedjen/nsarray-comprehension
- Owner: maxgoedjen
- Created: 2013-01-31T05:01:27.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-08T08:25:56.000Z (about 12 years ago)
- Last Synced: 2025-02-06T04:13:05.502Z (3 months ago)
- Language: Objective-C
- Size: 121 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
NSArray-Comprehension
=====================Python-like array comprehensions for Objective-C
Examples
========Square list of NSNumbers
NSArray *test = @[@1, @2, @3, @4, @5];
NSArray *comp = [test arrayWithComprehension:^id(id obj) {
return @([obj intValue] * [obj intValue]);
}];Filtering is also supported
NSArray *comp = [test arrayWithComprehension:^id(id obj) {
return @([obj intValue] * [obj intValue]);
} ifCondition:^BOOL(id obj) {
return ([obj intValue] % 2 == 0);
}];