Add some nullability specifiers to our public headers (#2291)

This commit is contained in:
Adlai Holler
2016-09-27 18:15:04 -04:00
committed by GitHub
parent ec64b9b229
commit f421787cd3
12 changed files with 53 additions and 17 deletions

View File

@@ -11,6 +11,8 @@
#import <AsyncDisplayKit/ASTextNode.h> #import <AsyncDisplayKit/ASTextNode.h>
#import <AsyncDisplayKit/ASImageNode.h> #import <AsyncDisplayKit/ASImageNode.h>
NS_ASSUME_NONNULL_BEGIN
/** /**
Image alignment defines where the image will be placed relative to the text. Image alignment defines where the image will be placed relative to the text.
*/ */
@@ -23,9 +25,9 @@ typedef NS_ENUM(NSInteger, ASButtonNodeImageAlignment) {
@interface ASButtonNode : ASControlNode @interface ASButtonNode : ASControlNode
@property (nonatomic, readonly) ASTextNode * _Nonnull titleNode; @property (nonatomic, readonly) ASTextNode * titleNode;
@property (nonatomic, readonly) ASImageNode * _Nonnull imageNode; @property (nonatomic, readonly) ASImageNode * imageNode;
@property (nonatomic, readonly) ASImageNode * _Nonnull backgroundImageNode; @property (nonatomic, readonly) ASImageNode * backgroundImageNode;
/** /**
Spacing between image and title. Defaults to 8.0. Spacing between image and title. Defaults to 8.0.
@@ -85,7 +87,7 @@ typedef NS_ENUM(NSInteger, ASButtonNodeImageAlignment) {
* @param color The color to use for the title. * @param color The color to use for the title.
* @param state The state that uses the specified title. The possible values are described in ASControlState. * @param state The state that uses the specified title. The possible values are described in ASControlState.
*/ */
- (void)setTitle:(nonnull NSString *)title withFont:(nullable UIFont *)font withColor:(nullable UIColor *)color forState:(ASControlState)state; - (void)setTitle:(NSString *)title withFont:(nullable UIFont *)font withColor:(nullable UIColor *)color forState:(ASControlState)state;
#endif #endif
/** /**
* Returns the image used for a button state. * Returns the image used for a button state.
@@ -94,7 +96,7 @@ typedef NS_ENUM(NSInteger, ASButtonNodeImageAlignment) {
* *
* @return The image used for the specified state. * @return The image used for the specified state.
*/ */
- (UIImage * _Nullable)imageForState:(ASControlState)state; - (nullable UIImage *)imageForState:(ASControlState)state;
/** /**
* Sets the image to use for the specified state. * Sets the image to use for the specified state.
@@ -120,6 +122,8 @@ typedef NS_ENUM(NSInteger, ASButtonNodeImageAlignment) {
* *
* @return The background image used for the specified state. * @return The background image used for the specified state.
*/ */
- (UIImage * _Nullable)backgroundImageForState:(ASControlState)state; - (nullable UIImage *)backgroundImageForState:(ASControlState)state;
@end @end
NS_ASSUME_NONNULL_END

View File

@@ -18,6 +18,8 @@
#import <AsyncDisplayKit/ASLayoutable.h> #import <AsyncDisplayKit/ASLayoutable.h>
#import <AsyncDisplayKit/ASContextTransitioning.h> #import <AsyncDisplayKit/ASContextTransitioning.h>
NS_ASSUME_NONNULL_BEGIN
#define ASDisplayNodeLoggingEnabled 0 #define ASDisplayNodeLoggingEnabled 0
@class ASDisplayNode; @class ASDisplayNode;
@@ -40,12 +42,12 @@ typedef CALayer * _Nonnull(^ASDisplayNodeLayerBlock)();
/** /**
* ASDisplayNode loaded callback block. This block is called BEFORE the -didLoad method and is always called on the main thread. * ASDisplayNode loaded callback block. This block is called BEFORE the -didLoad method and is always called on the main thread.
*/ */
typedef void (^ASDisplayNodeDidLoadBlock)(__kindof ASDisplayNode * _Nonnull node); typedef void (^ASDisplayNodeDidLoadBlock)(__kindof ASDisplayNode * node);
/** /**
* ASDisplayNode will / did render node content in context. * ASDisplayNode will / did render node content in context.
*/ */
typedef void (^ASDisplayNodeContextModifier)(_Nonnull CGContextRef context); typedef void (^ASDisplayNodeContextModifier)(CGContextRef context);
/** /**
* ASDisplayNode layout spec block. This block can be used instead of implementing layoutSpecThatFits: in subclass * ASDisplayNode layout spec block. This block can be used instead of implementing layoutSpecThatFits: in subclass
@@ -102,7 +104,6 @@ extern NSInteger const ASDefaultDrawingPriority;
* *
*/ */
NS_ASSUME_NONNULL_BEGIN
@interface ASDisplayNode : ASDealloc2MainObject <ASLayoutable> @interface ASDisplayNode : ASDealloc2MainObject <ASLayoutable>

View File

@@ -11,6 +11,7 @@
#import <AsyncDisplayKit/ASControlNode.h> #import <AsyncDisplayKit/ASControlNode.h>
#import "ASImageProtocols.h" #import "ASImageProtocols.h"
#import "ASBaseDefines.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@@ -120,7 +121,7 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image);
* `displaySuspended` is YES, `displayCompletionBlock` is will be * `displaySuspended` is YES, `displayCompletionBlock` is will be
* performed immediately and `YES` will be passed for `canceled`. * performed immediately and `YES` will be passed for `canceled`.
*/ */
- (void)setNeedsDisplayWithCompletion:(void (^ _Nullable)(BOOL canceled))displayCompletionBlock; - (void)setNeedsDisplayWithCompletion:(nullable void (^)(BOOL canceled))displayCompletionBlock;
#if TARGET_OS_TV #if TARGET_OS_TV
/** /**
@@ -164,9 +165,9 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image);
@interface ASImageNode (Unavailable) @interface ASImageNode (Unavailable)
- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; - (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE();
- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; - (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE();
@end @end

View File

@@ -14,6 +14,10 @@
#import "ASVisibilityProtocols.h" #import "ASVisibilityProtocols.h"
NS_ASSUME_NONNULL_BEGIN
@interface ASNavigationController : UINavigationController <ASManagesChildVisibilityDepth> @interface ASNavigationController : UINavigationController <ASManagesChildVisibilityDepth>
@end @end
NS_ASSUME_NONNULL_END

View File

@@ -12,6 +12,10 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ASPagerFlowLayout : UICollectionViewFlowLayout @interface ASPagerFlowLayout : UICollectionViewFlowLayout
@end @end
NS_ASSUME_NONNULL_END

View File

@@ -14,6 +14,10 @@
#import "ASVisibilityProtocols.h" #import "ASVisibilityProtocols.h"
NS_ASSUME_NONNULL_BEGIN
@interface ASTabBarController : UITabBarController <ASManagesChildVisibilityDepth> @interface ASTabBarController : UITabBarController <ASManagesChildVisibilityDepth>
@end @end
NS_ASSUME_NONNULL_END

View File

@@ -14,6 +14,8 @@
#import <AsyncDisplayKit/ASDisplayNode.h> #import <AsyncDisplayKit/ASDisplayNode.h>
#import <AsyncDisplayKit/ASRangeControllerUpdateRangeProtocol+Beta.h> #import <AsyncDisplayKit/ASRangeControllerUpdateRangeProtocol+Beta.h>
NS_ASSUME_NONNULL_BEGIN
@protocol ASTableDataSource; @protocol ASTableDataSource;
@protocol ASTableDelegate; @protocol ASTableDelegate;
@class ASTableView; @class ASTableView;
@@ -34,3 +36,5 @@
@property (weak, nonatomic) id <ASTableDataSource> dataSource; @property (weak, nonatomic) id <ASTableDataSource> dataSource;
@end @end
NS_ASSUME_NONNULL_END

View File

@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@abstract An array of descending scale factors that will be applied to this text node to try to make it fit within its constrained size @abstract An array of descending scale factors that will be applied to this text node to try to make it fit within its constrained size
@default nil (no scaling) @default nil (no scaling)
*/ */
@property (nullable, nonatomic, copy) NSArray *pointSizeScaleFactors; @property (nullable, nonatomic, copy) NSArray<NSNumber *> *pointSizeScaleFactors;
/** /**
@abstract Text margins for text laid out in the text node. @abstract Text margins for text laid out in the text node.

View File

@@ -14,6 +14,8 @@
#import "ASBaseDefines.h" #import "ASBaseDefines.h"
NS_ASSUME_NONNULL_BEGIN
@class UIViewController; @class UIViewController;
ASDISPLAYNODE_EXTERN_C_BEGIN ASDISPLAYNODE_EXTERN_C_BEGIN
@@ -106,3 +108,5 @@ ASDISPLAYNODE_EXTERN_C_END
_parentManagesVisibilityDepth = NO; \ _parentManagesVisibilityDepth = NO; \
[self visibilityDepthDidChange]; \ [self visibilityDepthDidChange]; \
} }
NS_ASSUME_NONNULL_END

View File

@@ -14,6 +14,8 @@
#import "ASImageNode.h" #import "ASImageNode.h"
#import "ASRangeController.h" #import "ASRangeController.h"
NS_ASSUME_NONNULL_BEGIN
@interface ASImageNode (Debugging) @interface ASImageNode (Debugging)
/** /**
@@ -67,3 +69,4 @@
@end @end
NS_ASSUME_NONNULL_END

View File

@@ -12,15 +12,19 @@
#import <AsyncDisplayKit/ASCollectionView.h> #import <AsyncDisplayKit/ASCollectionView.h>
NS_ASSUME_NONNULL_BEGIN
@protocol ASCollectionViewLayoutFacilitatorProtocol; @protocol ASCollectionViewLayoutFacilitatorProtocol;
@class ASCollectionNode; @class ASCollectionNode;
@class ASDataController; @class ASDataController;
@class ASRangeController; @class ASRangeController;
@interface ASCollectionView () @interface ASCollectionView ()
- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator ownedByNode:(BOOL)ownedByNode; - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator ownedByNode:(BOOL)ownedByNode;
@property (nonatomic, weak, readwrite) ASCollectionNode *collectionNode; @property (nonatomic, weak, readwrite) ASCollectionNode *collectionNode;
@property (nonatomic, strong, readonly) ASDataController *dataController; @property (nonatomic, strong, readonly) ASDataController *dataController;
@property (nonatomic, strong, readonly) ASRangeController *rangeController; @property (nonatomic, strong, readonly) ASRangeController *rangeController;
@end @end
NS_ASSUME_NONNULL_END

View File

@@ -13,9 +13,11 @@
#import <UIKit/UIImage.h> #import <UIKit/UIImage.h>
#import <UIKit/UIBezierPath.h> #import <UIKit/UIBezierPath.h>
NS_ASSUME_NONNULL_BEGIN
// High-performance flat-colored, rounded-corner resizable images // High-performance flat-colored, rounded-corner resizable images
// //
// For "Baked-in Opaque" corners, set cornerColor equal to the color behind the rounded image object, e.g. the background color. // For "Baked-in Opaque" corners, set cornerColor equal to the color behind the rounded image object, i.e. the background color.
// For "Baked-in Alpha" corners, set cornerColor = [UIColor clearColor] // For "Baked-in Alpha" corners, set cornerColor = [UIColor clearColor]
// //
// See http://asyncdisplaykit.org/docs/corner-rounding.html for an explanation. // See http://asyncdisplaykit.org/docs/corner-rounding.html for an explanation.
@@ -45,7 +47,7 @@
+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius + (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius
cornerColor:(UIColor *)cornerColor cornerColor:(UIColor *)cornerColor
fillColor:(UIColor *)fillColor fillColor:(UIColor *)fillColor
borderColor:(UIColor *)borderColor borderColor:(nullable UIColor *)borderColor
borderWidth:(CGFloat)borderWidth; borderWidth:(CGFloat)borderWidth;
/** /**
@@ -62,10 +64,11 @@
+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius + (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius
cornerColor:(UIColor *)cornerColor cornerColor:(UIColor *)cornerColor
fillColor:(UIColor *)fillColor fillColor:(UIColor *)fillColor
borderColor:(UIColor *)borderColor borderColor:(nullable UIColor *)borderColor
borderWidth:(CGFloat)borderWidth borderWidth:(CGFloat)borderWidth
roundedCorners:(UIRectCorner)roundedCorners roundedCorners:(UIRectCorner)roundedCorners
scale:(CGFloat)scale; scale:(CGFloat)scale;
@end @end
NS_ASSUME_NONNULL_END