mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Add a block API to provide an ASLayoutSpec without having to subclass ASDisplayNode
This commit is contained in:
@@ -42,6 +42,11 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode * _Nonnull node);
|
||||
*/
|
||||
typedef void (^ASDisplayNodeContextModifier)(_Nonnull CGContextRef context);
|
||||
|
||||
/**
|
||||
* ASDisplayNode layout spec block. This block can be used instead of implementing layoutSpecThatFits: in subclass
|
||||
*/
|
||||
typedef ASLayoutSpec * _Nonnull(^ASLayoutSpecBlock)(ASSizeRange constrainedSize);
|
||||
|
||||
/**
|
||||
Interface state is available on ASDisplayNode and ASViewController, and
|
||||
allows checking whether a node is in an interface situation where it is prudent to trigger certain
|
||||
@@ -252,6 +257,17 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize;
|
||||
|
||||
|
||||
/**
|
||||
* @abstract Provides a way to declare a block to provide an ASLayoutSpec without having to subclass ASDisplayNode and
|
||||
* implement layoutSpecThatFits:
|
||||
*
|
||||
* @return The block used to provide a ASLayoutSpec
|
||||
*
|
||||
* @warning Overwriting layoutSpecThatFits: in a subclass and providing a layoutSpecBlock block is currently not supported
|
||||
*/
|
||||
@property (nonatomic, readwrite, copy, nullable) ASLayoutSpecBlock layoutSpecBlock;
|
||||
|
||||
/**
|
||||
* @abstract Return the calculated size.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user