mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Initial Work for Range Controller to Support Supplementary Elements (#3140)
* Initial work supporting supplementaries in range controller * Rename indexPathForElementIfItem
This commit is contained in:
@@ -217,3 +217,31 @@
|
||||
id __val = x;\
|
||||
((c *) ([__val isKindOfClass:[c class]] ? __val : nil));\
|
||||
})
|
||||
|
||||
/**
|
||||
* Create a new set by mapping `collection` over `work`, ignoring nil.
|
||||
*/
|
||||
#define ASSetByFlatMapping(collection, decl, work) ({ \
|
||||
NSMutableSet *s = [NSMutableSet set]; \
|
||||
for (decl in collection) {\
|
||||
id result = work; \
|
||||
if (result != nil) { \
|
||||
[s addObject:result]; \
|
||||
} \
|
||||
} \
|
||||
s; \
|
||||
})
|
||||
|
||||
/**
|
||||
* Create a new array by mapping `collection` over `work`, ignoring nil.
|
||||
*/
|
||||
#define ASArrayByFlatMapping(collection, decl, work) ({ \
|
||||
NSMutableArray *a = [NSMutableArray array]; \
|
||||
for (decl in collection) {\
|
||||
id result = work; \
|
||||
if (result != nil) { \
|
||||
[a addObject:result]; \
|
||||
} \
|
||||
} \
|
||||
a; \
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user