mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-09 14:10:05 +00:00
Merge latest master and update Layout headers
This commit is contained in:
parent
cde790124d
commit
717df1cfd2
@ -9,11 +9,14 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <AsyncDisplayKit/ASDisplayNode.h>
|
#import <AsyncDisplayKit/ASDisplayNode.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface ASViewController : UIViewController
|
@interface ASViewController : UIViewController
|
||||||
|
|
||||||
@property (nonatomic, strong, readonly) ASDisplayNode *node;
|
@property (nonatomic, strong, readonly) ASDisplayNode *node;
|
||||||
|
|
||||||
//TODO Use nonnull annotation late on. Travis doesn't recognize it (yet).
|
|
||||||
- (instancetype)initWithNode:(ASDisplayNode *)node;
|
- (instancetype)initWithNode:(ASDisplayNode *)node;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@ -10,18 +10,21 @@
|
|||||||
|
|
||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Lays out a single layoutable child, then lays out a background layoutable instance behind it stretched to its size.
|
Lays out a single layoutable child, then lays out a background layoutable instance behind it stretched to its size.
|
||||||
*/
|
*/
|
||||||
@interface ASBackgroundLayoutSpec : ASLayoutSpec
|
@interface ASBackgroundLayoutSpec : ASLayoutSpec
|
||||||
|
|
||||||
@property (nonatomic, strong) id<ASLayoutable> background;
|
@property (nullable, nonatomic, strong) id<ASLayoutable> background;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param child A child that is laid out to determine the size of this spec. If this is nil, then this method
|
@param child A child that is laid out to determine the size of this spec.
|
||||||
returns nil.
|
@param background A layoutable object that is laid out behind the child. If this is nil, the background is omitted.
|
||||||
@param background A layoutable object that is laid out behind the child. May be nil, in which case the background is omitted.
|
|
||||||
*/
|
*/
|
||||||
+ (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutable>)child background:(id<ASLayoutable>)background;
|
+ (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutable>)child background:(nullable id<ASLayoutable>)background;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -34,6 +34,8 @@ typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) {
|
|||||||
ASCenterLayoutSpecSizingOptionMinimumXY = ASCenterLayoutSpecSizingOptionMinimumX | ASCenterLayoutSpecSizingOptionMinimumY,
|
ASCenterLayoutSpecSizingOptionMinimumXY = ASCenterLayoutSpecSizingOptionMinimumX | ASCenterLayoutSpecSizingOptionMinimumY,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/** Lays out a single layoutable child and position it so that it is centered into the layout bounds. */
|
/** Lays out a single layoutable child and position it so that it is centered into the layout bounds. */
|
||||||
@interface ASCenterLayoutSpec : ASLayoutSpec
|
@interface ASCenterLayoutSpec : ASLayoutSpec
|
||||||
|
|
||||||
@ -54,3 +56,5 @@ typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) {
|
|||||||
child:(id<ASLayoutable>)child;
|
child:(id<ASLayoutable>)child;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -35,6 +35,7 @@ typedef struct {
|
|||||||
extern ASRelativeDimension const ASRelativeDimensionUnconstrained;
|
extern ASRelativeDimension const ASRelativeDimensionUnconstrained;
|
||||||
|
|
||||||
ASDISPLAYNODE_EXTERN_C_BEGIN
|
ASDISPLAYNODE_EXTERN_C_BEGIN
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
#pragma mark ASRelativeDimension
|
#pragma mark ASRelativeDimension
|
||||||
|
|
||||||
@ -70,4 +71,5 @@ extern BOOL ASSizeRangeEqualToSizeRange(ASSizeRange lhs, ASSizeRange rhs);
|
|||||||
|
|
||||||
extern NSString *NSStringFromASSizeRange(ASSizeRange sizeRange);
|
extern NSString *NSStringFromASSizeRange(ASSizeRange sizeRange);
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
ASDISPLAYNODE_EXTERN_C_END
|
ASDISPLAYNODE_EXTERN_C_END
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A layout spec that wraps another layoutable child, applying insets around it.
|
A layout spec that wraps another layoutable child, applying insets around it.
|
||||||
|
|
||||||
@ -33,8 +35,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@param insets The amount of space to inset on each side.
|
@param insets The amount of space to inset on each side.
|
||||||
@param child The wrapped child to inset. If nil, this method returns nil.
|
@param child The wrapped child to inset.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutable>)child;
|
+ (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id<ASLayoutable>)child;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#import <AsyncDisplayKit/ASAssert.h>
|
#import <AsyncDisplayKit/ASAssert.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutable.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
extern CGPoint const CGPointNull;
|
extern CGPoint const CGPointNull;
|
||||||
|
|
||||||
extern BOOL CGPointIsNull(CGPoint point);
|
extern BOOL CGPointIsNull(CGPoint point);
|
||||||
@ -30,7 +32,7 @@ extern BOOL CGPointIsNull(CGPoint point);
|
|||||||
/**
|
/**
|
||||||
* Array of ASLayouts. Each must have a valid non-null position.
|
* Array of ASLayouts. Each must have a valid non-null position.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly) NSArray *sublayouts;
|
@property (nonatomic, readonly) NSArray<ASLayout *> *sublayouts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializer.
|
* Initializer.
|
||||||
@ -46,7 +48,7 @@ extern BOOL CGPointIsNull(CGPoint point);
|
|||||||
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject
|
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
position:(CGPoint)position
|
position:(CGPoint)position
|
||||||
sublayouts:(NSArray *)sublayouts;
|
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience initializer that has CGPointNull position.
|
* Convenience initializer that has CGPointNull position.
|
||||||
@ -62,7 +64,7 @@ extern BOOL CGPointIsNull(CGPoint point);
|
|||||||
*/
|
*/
|
||||||
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject
|
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject
|
||||||
size:(CGSize)size
|
size:(CGSize)size
|
||||||
sublayouts:(NSArray *)sublayouts;
|
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience that has CGPointNull position and no sublayouts.
|
* Convenience that has CGPointNull position and no sublayouts.
|
||||||
@ -89,3 +91,5 @@ extern BOOL CGPointIsNull(CGPoint point);
|
|||||||
- (ASLayout *)flattenedLayoutUsingPredicateBlock:(BOOL (^)(ASLayout *evaluatedLayout))predicateBlock;
|
- (ASLayout *)flattenedLayoutUsingPredicateBlock:(BOOL (^)(ASLayout *evaluatedLayout))predicateBlock;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@protocol ASLayoutable;
|
@protocol ASLayoutable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +54,7 @@
|
|||||||
*
|
*
|
||||||
* @return a new instance of ASLayoutOptions
|
* @return a new instance of ASLayoutOptions
|
||||||
*/
|
*/
|
||||||
- (instancetype)initWithLayoutable:(id<ASLayoutable>)layoutable;
|
- (instancetype)initWithLayoutable:(id<ASLayoutable>)layoutable NS_DESIGNATED_INITIALIZER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the values of layoutOptions into self. This is useful when placing a layoutable inside of another. Consider
|
* Copies the values of layoutOptions into self. This is useful when placing a layoutable inside of another. Consider
|
||||||
@ -83,3 +85,6 @@
|
|||||||
@property (nonatomic, readwrite) CGPoint layoutPosition;
|
@property (nonatomic, readwrite) CGPoint layoutPosition;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutable.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/** A layout spec is an immutable object that describes a layout, loosely inspired by React. */
|
/** A layout spec is an immutable object that describes a layout, loosely inspired by React. */
|
||||||
@interface ASLayoutSpec : NSObject <ASLayoutable>
|
@interface ASLayoutSpec : NSObject <ASLayoutable>
|
||||||
|
|
||||||
@ -69,7 +71,7 @@
|
|||||||
* For good measure, in these layout specs it probably makes sense to define
|
* For good measure, in these layout specs it probably makes sense to define
|
||||||
* setChild: and setChild:forIdentifier: methods to do something appropriate or to assert.
|
* setChild: and setChild:forIdentifier: methods to do something appropriate or to assert.
|
||||||
*/
|
*/
|
||||||
- (void)setChildren:(NSArray *)children;
|
- (void)setChildren:(NSArray<id<ASLayoutable>> *)children;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get child methods
|
* Get child methods
|
||||||
@ -83,16 +85,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** Returns the child added to this layout spec using the default identifier. */
|
/** Returns the child added to this layout spec using the default identifier. */
|
||||||
- (id<ASLayoutable>)child;
|
- (nullable id<ASLayoutable>)child;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the child added to this layout spec using the given identifier.
|
* Returns the child added to this layout spec using the given identifier.
|
||||||
*
|
*
|
||||||
* @param identifier An identifier associated withe the child.
|
* @param identifier An identifier associated withe the child.
|
||||||
*/
|
*/
|
||||||
- (id<ASLayoutable>)childForIdentifier:(NSString *)identifier;
|
- (nullable id<ASLayoutable>)childForIdentifier:(NSString *)identifier;
|
||||||
|
|
||||||
/** Returns all children added to this layout spec. */
|
/** Returns all children added to this layout spec. */
|
||||||
- (NSArray *)children;
|
- (NSArray<id<ASLayoutable>> *)children;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
@class ASLayout;
|
@class ASLayout;
|
||||||
@class ASLayoutSpec;
|
@class ASLayoutSpec;
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ASLayoutable protocol declares a method for measuring the layout of an object. A layout
|
* The ASLayoutable protocol declares a method for measuring the layout of an object. A layout
|
||||||
* is defined by an ASLayout return value, and must specify 1) the size (but not position) of the
|
* is defined by an ASLayout return value, and must specify 1) the size (but not position) of the
|
||||||
@ -107,3 +109,5 @@
|
|||||||
@property (nonatomic, assign) CGPoint layoutPosition;
|
@property (nonatomic, assign) CGPoint layoutPosition;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -10,13 +10,17 @@
|
|||||||
|
|
||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This layout spec lays out a single layoutable child and then overlays a layoutable object on top of it streched to its size
|
This layout spec lays out a single layoutable child and then overlays a layoutable object on top of it streched to its size
|
||||||
*/
|
*/
|
||||||
@interface ASOverlayLayoutSpec : ASLayoutSpec
|
@interface ASOverlayLayoutSpec : ASLayoutSpec
|
||||||
|
|
||||||
@property (nonatomic, strong) id<ASLayoutable> overlay;
|
@property (nullable, nonatomic, strong) id<ASLayoutable> overlay;
|
||||||
|
|
||||||
+ (instancetype)overlayLayoutSpecWithChild:(id<ASLayoutable>)child overlay:(id<ASLayoutable>)overlay;
|
+ (instancetype)overlayLayoutSpecWithChild:(id<ASLayoutable>)child overlay:(nullable id<ASLayoutable>)overlay;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutable.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ratio layout spec
|
Ratio layout spec
|
||||||
For when the content should respect a certain inherent ratio but can be scaled (think photos or videos)
|
For when the content should respect a certain inherent ratio but can be scaled (think photos or videos)
|
||||||
@ -36,3 +38,5 @@
|
|||||||
+ (instancetype)ratioLayoutSpecWithRatio:(CGFloat)ratio child:(id<ASLayoutable>)child;
|
+ (instancetype)ratioLayoutSpecWithRatio:(CGFloat)ratio child:(id<ASLayoutable>)child;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -33,6 +33,7 @@ typedef struct {
|
|||||||
extern ASRelativeSizeRange const ASRelativeSizeRangeUnconstrained;
|
extern ASRelativeSizeRange const ASRelativeSizeRangeUnconstrained;
|
||||||
|
|
||||||
ASDISPLAYNODE_EXTERN_C_BEGIN
|
ASDISPLAYNODE_EXTERN_C_BEGIN
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark ASRelativeSize
|
#pragma mark ASRelativeSize
|
||||||
@ -70,4 +71,5 @@ extern BOOL ASRelativeSizeRangeEqualToRelativeSizeRange(ASRelativeSizeRange lhs,
|
|||||||
extern ASSizeRange ASRelativeSizeRangeResolve(ASRelativeSizeRange relativeSizeRange,
|
extern ASSizeRange ASRelativeSizeRangeResolve(ASRelativeSizeRange relativeSizeRange,
|
||||||
CGSize parentSize);
|
CGSize parentSize);
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
ASDISPLAYNODE_EXTERN_C_END
|
ASDISPLAYNODE_EXTERN_C_END
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
|
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A simple layout spec that stacks a list of children vertically or horizontally.
|
A simple layout spec that stacks a list of children vertically or horizontally.
|
||||||
@ -55,6 +56,8 @@
|
|||||||
@param alignItems Orientation of the children along the cross axis
|
@param alignItems Orientation of the children along the cross axis
|
||||||
@param children ASLayoutable children to be positioned.
|
@param children ASLayoutable children to be positioned.
|
||||||
*/
|
*/
|
||||||
+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems children:(NSArray *)children;
|
+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems children:(NSArray<id<ASLayoutable>> *)children;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@ -11,6 +11,8 @@
|
|||||||
#import <AsyncDisplayKit/ASDimension.h>
|
#import <AsyncDisplayKit/ASDimension.h>
|
||||||
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
|
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout options that can be defined for an ASLayoutable being added to a ASStackLayoutSpec.
|
* Layout options that can be defined for an ASLayoutable being added to a ASStackLayoutSpec.
|
||||||
*/
|
*/
|
||||||
@ -64,3 +66,5 @@
|
|||||||
@property (nonatomic, readwrite) CGFloat descender;
|
@property (nonatomic, readwrite) CGFloat descender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||||
#import <AsyncDisplayKit/ASRelativeSize.h>
|
#import <AsyncDisplayKit/ASRelativeSize.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A layout spec that positions children at fixed positions.
|
* A layout spec that positions children at fixed positions.
|
||||||
*
|
*
|
||||||
@ -21,6 +23,8 @@
|
|||||||
/**
|
/**
|
||||||
@param children Children to be positioned at fixed positions, each conforms to ASStaticLayoutable
|
@param children Children to be positioned at fixed positions, each conforms to ASStaticLayoutable
|
||||||
*/
|
*/
|
||||||
+ (instancetype)staticLayoutSpecWithChildren:(NSArray *)children;
|
+ (instancetype)staticLayoutSpecWithChildren:(NSArray<id<ASStaticLayoutable>> *)children;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#import <AsyncDisplayKit/ASRelativeSize.h>
|
#import <AsyncDisplayKit/ASRelativeSize.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout options that can be defined for an ASLayoutable being added to a ASStaticLayoutSpec.
|
* Layout options that can be defined for an ASLayoutable being added to a ASStaticLayoutSpec.
|
||||||
*/
|
*/
|
||||||
@ -24,3 +26,5 @@
|
|||||||
@property (nonatomic, assign) CGPoint layoutPosition;
|
@property (nonatomic, assign) CGPoint layoutPosition;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user