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 <AsyncDisplayKit/ASDisplayNode.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ASViewController : UIViewController
|
||||
|
||||
@property (nonatomic, strong, readonly) ASDisplayNode *node;
|
||||
|
||||
//TODO Use nonnull annotation late on. Travis doesn't recognize it (yet).
|
||||
- (instancetype)initWithNode:(ASDisplayNode *)node;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -10,18 +10,21 @@
|
||||
|
||||
#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.
|
||||
*/
|
||||
@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
|
||||
returns nil.
|
||||
@param background A layoutable object that is laid out behind the child. May be nil, in which case the background is omitted.
|
||||
@param child A child that is laid out to determine the size of this spec.
|
||||
@param background A layoutable object that is laid out behind the child. If this is nil, the background is omitted.
|
||||
*/
|
||||
+ (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutable>)child background:(id<ASLayoutable>)background;
|
||||
+ (instancetype)backgroundLayoutSpecWithChild:(id<ASLayoutable>)child background:(nullable id<ASLayoutable>)background;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -34,6 +34,8 @@ typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) {
|
||||
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. */
|
||||
@interface ASCenterLayoutSpec : ASLayoutSpec
|
||||
|
||||
@ -54,3 +56,5 @@ typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) {
|
||||
child:(id<ASLayoutable>)child;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -35,6 +35,7 @@ typedef struct {
|
||||
extern ASRelativeDimension const ASRelativeDimensionUnconstrained;
|
||||
|
||||
ASDISPLAYNODE_EXTERN_C_BEGIN
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark ASRelativeDimension
|
||||
|
||||
@ -70,4 +71,5 @@ extern BOOL ASSizeRangeEqualToSizeRange(ASSizeRange lhs, ASSizeRange rhs);
|
||||
|
||||
extern NSString *NSStringFromASSizeRange(ASSizeRange sizeRange);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
ASDISPLAYNODE_EXTERN_C_END
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
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 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;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -12,6 +12,8 @@
|
||||
#import <AsyncDisplayKit/ASAssert.h>
|
||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern CGPoint const CGPointNull;
|
||||
|
||||
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.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSArray *sublayouts;
|
||||
@property (nonatomic, readonly) NSArray<ASLayout *> *sublayouts;
|
||||
|
||||
/**
|
||||
* Initializer.
|
||||
@ -46,7 +48,7 @@ extern BOOL CGPointIsNull(CGPoint point);
|
||||
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject
|
||||
size:(CGSize)size
|
||||
position:(CGPoint)position
|
||||
sublayouts:(NSArray *)sublayouts;
|
||||
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts;
|
||||
|
||||
/**
|
||||
* Convenience initializer that has CGPointNull position.
|
||||
@ -62,7 +64,7 @@ extern BOOL CGPointIsNull(CGPoint point);
|
||||
*/
|
||||
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject
|
||||
size:(CGSize)size
|
||||
sublayouts:(NSArray *)sublayouts;
|
||||
sublayouts:(nullable NSArray<ASLayout *> *)sublayouts;
|
||||
|
||||
/**
|
||||
* Convenience that has CGPointNull position and no sublayouts.
|
||||
@ -89,3 +91,5 @@ extern BOOL CGPointIsNull(CGPoint point);
|
||||
- (ASLayout *)flattenedLayoutUsingPredicateBlock:(BOOL (^)(ASLayout *evaluatedLayout))predicateBlock;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -11,6 +11,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol ASLayoutable;
|
||||
|
||||
/**
|
||||
@ -52,7 +54,7 @@
|
||||
*
|
||||
* @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
|
||||
@ -83,3 +85,6 @@
|
||||
@property (nonatomic, readwrite) CGPoint layoutPosition;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** A layout spec is an immutable object that describes a layout, loosely inspired by React. */
|
||||
@interface ASLayoutSpec : NSObject <ASLayoutable>
|
||||
|
||||
@ -69,7 +71,7 @@
|
||||
* 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.
|
||||
*/
|
||||
- (void)setChildren:(NSArray *)children;
|
||||
- (void)setChildren:(NSArray<id<ASLayoutable>> *)children;
|
||||
|
||||
/**
|
||||
* Get child methods
|
||||
@ -83,16 +85,19 @@
|
||||
*/
|
||||
|
||||
/** 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.
|
||||
*
|
||||
* @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. */
|
||||
- (NSArray *)children;
|
||||
- (NSArray<id<ASLayoutable>> *)children;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
@class ASLayout;
|
||||
@class ASLayoutSpec;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -107,3 +109,5 @@
|
||||
@property (nonatomic, assign) CGPoint layoutPosition;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -10,13 +10,17 @@
|
||||
|
||||
#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
|
||||
*/
|
||||
@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
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -11,6 +11,8 @@
|
||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
Ratio layout spec
|
||||
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;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -33,6 +33,7 @@ typedef struct {
|
||||
extern ASRelativeSizeRange const ASRelativeSizeRangeUnconstrained;
|
||||
|
||||
ASDISPLAYNODE_EXTERN_C_BEGIN
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark ASRelativeSize
|
||||
@ -70,4 +71,5 @@ extern BOOL ASRelativeSizeRangeEqualToRelativeSizeRange(ASRelativeSizeRange lhs,
|
||||
extern ASSizeRange ASRelativeSizeRangeResolve(ASRelativeSizeRange relativeSizeRange,
|
||||
CGSize parentSize);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
ASDISPLAYNODE_EXTERN_C_END
|
||||
|
@ -11,6 +11,7 @@
|
||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
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 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
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -11,6 +11,8 @@
|
||||
#import <AsyncDisplayKit/ASDimension.h>
|
||||
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Layout options that can be defined for an ASLayoutable being added to a ASStackLayoutSpec.
|
||||
*/
|
||||
@ -64,3 +66,5 @@
|
||||
@property (nonatomic, readwrite) CGFloat descender;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -11,6 +11,8 @@
|
||||
#import <AsyncDisplayKit/ASLayoutSpec.h>
|
||||
#import <AsyncDisplayKit/ASRelativeSize.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
+ (instancetype)staticLayoutSpecWithChildren:(NSArray *)children;
|
||||
+ (instancetype)staticLayoutSpecWithChildren:(NSArray<id<ASStaticLayoutable>> *)children;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#import <AsyncDisplayKit/ASRelativeSize.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Layout options that can be defined for an ASLayoutable being added to a ASStaticLayoutSpec.
|
||||
*/
|
||||
@ -24,3 +26,5 @@
|
||||
@property (nonatomic, assign) CGPoint layoutPosition;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
Loading…
x
Reference in New Issue
Block a user