diff --git a/AsyncDisplayKit/ASViewController.h b/AsyncDisplayKit/ASViewController.h index e3b18661fe..aca6626fb7 100644 --- a/AsyncDisplayKit/ASViewController.h +++ b/AsyncDisplayKit/ASViewController.h @@ -9,11 +9,14 @@ #import #import +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 \ No newline at end of file diff --git a/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h b/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h index cab51ea8b3..9f04490cc3 100644 --- a/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h @@ -10,18 +10,21 @@ #import +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 background; +@property (nullable, nonatomic, strong) id 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)child background:(id)background; ++ (instancetype)backgroundLayoutSpecWithChild:(id)child background:(nullable id)background; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASCenterLayoutSpec.h b/AsyncDisplayKit/Layout/ASCenterLayoutSpec.h index 37ba24e7e7..f8413d275e 100644 --- a/AsyncDisplayKit/Layout/ASCenterLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASCenterLayoutSpec.h @@ -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)child; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASDimension.h b/AsyncDisplayKit/Layout/ASDimension.h index 590f9486de..c96b2155ae 100644 --- a/AsyncDisplayKit/Layout/ASDimension.h +++ b/AsyncDisplayKit/Layout/ASDimension.h @@ -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 diff --git a/AsyncDisplayKit/Layout/ASInsetLayoutSpec.h b/AsyncDisplayKit/Layout/ASInsetLayoutSpec.h index ab0a6f106f..aa320e947d 100644 --- a/AsyncDisplayKit/Layout/ASInsetLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASInsetLayoutSpec.h @@ -10,6 +10,8 @@ #import +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)child; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASLayout.h b/AsyncDisplayKit/Layout/ASLayout.h index 71892b5996..4619269d12 100644 --- a/AsyncDisplayKit/Layout/ASLayout.h +++ b/AsyncDisplayKit/Layout/ASLayout.h @@ -12,6 +12,8 @@ #import #import +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 *sublayouts; /** * Initializer. @@ -46,7 +48,7 @@ extern BOOL CGPointIsNull(CGPoint point); + (instancetype)layoutWithLayoutableObject:(id)layoutableObject size:(CGSize)size position:(CGPoint)position - sublayouts:(NSArray *)sublayouts; + sublayouts:(nullable NSArray *)sublayouts; /** * Convenience initializer that has CGPointNull position. @@ -62,7 +64,7 @@ extern BOOL CGPointIsNull(CGPoint point); */ + (instancetype)layoutWithLayoutableObject:(id)layoutableObject size:(CGSize)size - sublayouts:(NSArray *)sublayouts; + sublayouts:(nullable NSArray *)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 diff --git a/AsyncDisplayKit/Layout/ASLayoutOptions.h b/AsyncDisplayKit/Layout/ASLayoutOptions.h index 7b9800ff79..799f3e6b1a 100644 --- a/AsyncDisplayKit/Layout/ASLayoutOptions.h +++ b/AsyncDisplayKit/Layout/ASLayoutOptions.h @@ -11,6 +11,8 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + @protocol ASLayoutable; /** @@ -52,7 +54,7 @@ * * @return a new instance of ASLayoutOptions */ -- (instancetype)initWithLayoutable:(id)layoutable; +- (instancetype)initWithLayoutable:(id)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 + diff --git a/AsyncDisplayKit/Layout/ASLayoutSpec.h b/AsyncDisplayKit/Layout/ASLayoutSpec.h index 2dd00198ff..15dda10ce6 100644 --- a/AsyncDisplayKit/Layout/ASLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASLayoutSpec.h @@ -10,6 +10,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + /** A layout spec is an immutable object that describes a layout, loosely inspired by React. */ @interface ASLayoutSpec : NSObject @@ -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> *)children; /** * Get child methods @@ -83,16 +85,19 @@ */ /** Returns the child added to this layout spec using the default identifier. */ -- (id)child; +- (nullable id)child; /** * Returns the child added to this layout spec using the given identifier. * * @param identifier An identifier associated withe the child. */ -- (id)childForIdentifier:(NSString *)identifier; +- (nullable id)childForIdentifier:(NSString *)identifier; /** Returns all children added to this layout spec. */ -- (NSArray *)children; +- (NSArray> *)children; @end + +NS_ASSUME_NONNULL_END + diff --git a/AsyncDisplayKit/Layout/ASLayoutable.h b/AsyncDisplayKit/Layout/ASLayoutable.h index 7e0e950d3f..4653e38def 100644 --- a/AsyncDisplayKit/Layout/ASLayoutable.h +++ b/AsyncDisplayKit/Layout/ASLayoutable.h @@ -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 diff --git a/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.h b/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.h index 05e53d92e8..6e1c321bc7 100644 --- a/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASOverlayLayoutSpec.h @@ -10,13 +10,17 @@ #import +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 overlay; +@property (nullable, nonatomic, strong) id overlay; -+ (instancetype)overlayLayoutSpecWithChild:(id)child overlay:(id)overlay; ++ (instancetype)overlayLayoutSpecWithChild:(id)child overlay:(nullable id)overlay; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASRatioLayoutSpec.h b/AsyncDisplayKit/Layout/ASRatioLayoutSpec.h index 2affa56a75..f910982985 100644 --- a/AsyncDisplayKit/Layout/ASRatioLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASRatioLayoutSpec.h @@ -11,6 +11,8 @@ #import #import +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)child; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASRelativeSize.h b/AsyncDisplayKit/Layout/ASRelativeSize.h index 9522d43de3..db5d662a9b 100644 --- a/AsyncDisplayKit/Layout/ASRelativeSize.h +++ b/AsyncDisplayKit/Layout/ASRelativeSize.h @@ -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 diff --git a/AsyncDisplayKit/Layout/ASStackLayoutSpec.h b/AsyncDisplayKit/Layout/ASStackLayoutSpec.h index dd331f1405..d6aa54b157 100644 --- a/AsyncDisplayKit/Layout/ASStackLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASStackLayoutSpec.h @@ -11,6 +11,7 @@ #import #import +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> *)children; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/Layout/ASStackLayoutable.h b/AsyncDisplayKit/Layout/ASStackLayoutable.h index 3ebc9304f0..9044a27585 100644 --- a/AsyncDisplayKit/Layout/ASStackLayoutable.h +++ b/AsyncDisplayKit/Layout/ASStackLayoutable.h @@ -11,6 +11,8 @@ #import #import +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 diff --git a/AsyncDisplayKit/Layout/ASStaticLayoutSpec.h b/AsyncDisplayKit/Layout/ASStaticLayoutSpec.h index 8bd3f3d9f2..44da4adf3d 100644 --- a/AsyncDisplayKit/Layout/ASStaticLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASStaticLayoutSpec.h @@ -11,6 +11,8 @@ #import #import +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> *)children; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASStaticLayoutable.h b/AsyncDisplayKit/Layout/ASStaticLayoutable.h index e0325cfc05..8e5f6e6275 100644 --- a/AsyncDisplayKit/Layout/ASStaticLayoutable.h +++ b/AsyncDisplayKit/Layout/ASStaticLayoutable.h @@ -10,6 +10,8 @@ #import +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