diff --git a/.travis.yml b/.travis.yml index 520f2f76..fd3259eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode7 +osx_image: xcode7.2 before_install: - brew update - brew reinstall xctool diff --git a/AsyncDisplayKit-Prefix.gcda b/AsyncDisplayKit-Prefix.gcda index 7564c6c3..83c74d3f 100644 Binary files a/AsyncDisplayKit-Prefix.gcda and b/AsyncDisplayKit-Prefix.gcda differ diff --git a/AsyncDisplayKit/ASButtonNode.h b/AsyncDisplayKit/ASButtonNode.h index 57b7caf1..81564962 100644 --- a/AsyncDisplayKit/ASButtonNode.h +++ b/AsyncDisplayKit/ASButtonNode.h @@ -6,7 +6,8 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#import +#import +#import typedef enum : NSUInteger { ASButtonStateNormal, diff --git a/AsyncDisplayKit/ASButtonNode.mm b/AsyncDisplayKit/ASButtonNode.mm index 196216a6..0d400441 100644 --- a/AsyncDisplayKit/ASButtonNode.mm +++ b/AsyncDisplayKit/ASButtonNode.mm @@ -7,8 +7,9 @@ */ #import "ASButtonNode.h" - -#import +#import "ASStackLayoutSpec.h" +#import "ASThread.h" +#import "ASDisplayNode+Subclasses.h" @interface ASButtonNode () { diff --git a/AsyncDisplayKit/ASCellNode.h b/AsyncDisplayKit/ASCellNode.h index b8957498..d1e57538 100644 --- a/AsyncDisplayKit/ASCellNode.h +++ b/AsyncDisplayKit/ASCellNode.h @@ -8,6 +8,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + @class ASCellNode; typedef NSUInteger ASCellNodeAnimation; @@ -77,10 +79,10 @@ typedef NSUInteger ASCellNodeAnimation; * ASCellNode must forward touch events in order for UITableView and UICollectionView tap handling to work. Overriding * these methods (e.g. for highlighting) requires the super method be called. */ -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; +- (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; +- (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; +- (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; +- (void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; /** * Marks the node as needing layout. Convenience for use whether the view / layer is loaded or not. @@ -119,3 +121,5 @@ typedef NSUInteger ASCellNodeAnimation; @property (nonatomic, copy) NSString *text; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASCellNode.m b/AsyncDisplayKit/ASCellNode.m index f757f863..16d8f32d 100644 --- a/AsyncDisplayKit/ASCellNode.m +++ b/AsyncDisplayKit/ASCellNode.m @@ -167,7 +167,8 @@ static const CGFloat kFontSize = 18.0f; { if (!(self = [super init])) return nil; - + + _text = @""; _textNode = [[ASTextNode alloc] init]; [self addSubnode:_textNode]; diff --git a/AsyncDisplayKit/ASCollectionNode.h b/AsyncDisplayKit/ASCollectionNode.h index 8dcdb793..7f9b6e31 100644 --- a/AsyncDisplayKit/ASCollectionNode.h +++ b/AsyncDisplayKit/ASCollectionNode.h @@ -8,6 +8,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + /** * ASCollectionNode is a node based class that wraps an ASCollectionView. It can be used * as a subnode of another node, and provide room for many (great) features and improvements later on. @@ -67,3 +69,5 @@ - (void)reloadDataImmediately; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASCollectionNode.m b/AsyncDisplayKit/ASCollectionNode.m index 315c3626..1b8484b7 100644 --- a/AsyncDisplayKit/ASCollectionNode.m +++ b/AsyncDisplayKit/ASCollectionNode.m @@ -30,7 +30,8 @@ - (instancetype)init { ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER(); - self = [self initWithCollectionViewLayout:nil]; // Will throw an exception for lacking a UICV Layout. + UICollectionViewLayout *nilLayout = nil; + self = [self initWithCollectionViewLayout:nilLayout]; // Will throw an exception for lacking a UICV Layout. return nil; } diff --git a/AsyncDisplayKit/ASCollectionView.h b/AsyncDisplayKit/ASCollectionView.h index f7cd8da0..55b3afaf 100644 --- a/AsyncDisplayKit/ASCollectionView.h +++ b/AsyncDisplayKit/ASCollectionView.h @@ -19,6 +19,8 @@ @protocol ASCollectionDelegate; @protocol ASCollectionViewLayoutInspecting; +NS_ASSUME_NONNULL_BEGIN + /** * Node-based collection view. * @@ -87,7 +89,7 @@ * Boolean parameter that contains the value YES if all of the related animations completed successfully or * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. */ -- (void)performBatchAnimated:(BOOL)animated updates:(void (^)())updates completion:(void (^)(BOOL))completion; +- (void)performBatchAnimated:(BOOL)animated updates:(void (^ _Nullable)())updates completion:(void (^ _Nullable)(BOOL))completion; /** * Perform a batch of updates asynchronously. This method must be called from the main thread. @@ -98,7 +100,7 @@ * Boolean parameter that contains the value YES if all of the related animations completed successfully or * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. */ -- (void)performBatchUpdates:(void (^)())updates completion:(void (^)(BOOL))completion; +- (void)performBatchUpdates:(void (^ _Nullable)())updates completion:(void (^ _Nullable)(BOOL))completion; /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -107,7 +109,7 @@ * the main thread. * @warning This method is substantially more expensive than UICollectionView's version. */ -- (void)reloadDataWithCompletion:(void (^)())completion; +- (void)reloadDataWithCompletion:(void (^ _Nullable)())completion; /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -186,7 +188,7 @@ * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes * before this method is called. */ -- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths; +- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths; /** * Deletes the items specified by an array of index paths. @@ -196,7 +198,7 @@ * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes * before this method is called. */ -- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths; +- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths; /** * Reloads the specified items. @@ -206,7 +208,7 @@ * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes * before this method is called. */ -- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths; +- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths; /** * Moves the item at a specified location to a destination location. @@ -243,7 +245,7 @@ * * @returns an array containing the nodes being displayed on screen. */ -- (NSArray *)visibleNodes; +- (NSArray *)visibleNodes; /** * Query the sized node at `indexPath` for its calculatedSize. @@ -354,7 +356,7 @@ @optional - (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath; -- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNodeForItemAtIndexPath:(NSIndexPath*)indexPath; +- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNodeForItemAtIndexPath:(NSIndexPath *)indexPath; /** * Receive a message that the collectionView is near the end of its data set and more data should be fetched if @@ -423,3 +425,5 @@ - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout asyncDataFetching:(BOOL)asyncDataFetchingEnabled ASDISPLAYNODE_DEPRECATED; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index c044919b..8686ce6c 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -9,7 +9,6 @@ #import "ASAssert.h" #import "ASBatchFetching.h" #import "ASDelegateProxy.h" -#import "ASCollectionView.h" #import "ASCollectionNode.h" #import "ASCollectionDataController.h" #import "ASCollectionViewLayoutController.h" diff --git a/AsyncDisplayKit/ASCollectionViewProtocols.h b/AsyncDisplayKit/ASCollectionViewProtocols.h index 0f0b5ed7..5c4bcf96 100644 --- a/AsyncDisplayKit/ASCollectionViewProtocols.h +++ b/AsyncDisplayKit/ASCollectionViewProtocols.h @@ -6,6 +6,8 @@ * of patent rights can be found in the PATENTS file in the same directory. */ +NS_ASSUME_NONNULL_BEGIN + /** * This is a subset of UICollectionViewDataSource. * @@ -50,7 +52,9 @@ - (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath; -- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender; -- (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender; +- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender; +- (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASControlNode+Subclasses.h b/AsyncDisplayKit/ASControlNode+Subclasses.h index 062f2154..107de031 100644 --- a/AsyncDisplayKit/ASControlNode+Subclasses.h +++ b/AsyncDisplayKit/ASControlNode+Subclasses.h @@ -6,8 +6,9 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#import +#import "ASControlNode.h" +NS_ASSUME_NONNULL_BEGIN /** * The subclass header _ASControlNode+Subclasses_ defines methods to be @@ -24,7 +25,7 @@ @param touchEvent An event object encapsulating the information specific to the user event. @discussion ASControlNode implements this method to send all action messages associated with controlEvents. The list of targets is constructed from prior invocations of addTarget:action:forControlEvents:. */ -- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(UIEvent *)touchEvent; +- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)touchEvent; /** @abstract Sent to the control when tracking begins. @@ -32,7 +33,7 @@ @param touchEvent An event object encapsulating the information specific to the user event. @result YES if the receiver should respond continuously (respond when touch is dragged); NO otherwise. */ -- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)touchEvent; +- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(nullable UIEvent *)touchEvent; /** @abstract Sent continuously to the control as it tracks a touch within the control's bounds. @@ -40,20 +41,20 @@ @param touchEvent An event object encapsulating the information specific to the user event. @result YES if touch tracking should continue; NO otherwise. */ -- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)touchEvent; +- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(nullable UIEvent *)touchEvent; /** @abstract Sent to the control when tracking should be cancelled. @param touchEvent An event object encapsulating the information specific to the user event. This parameter may be nil, indicating that the cancelation was caused by something other than an event, such as the display node being removed from its supernode. */ -- (void)cancelTrackingWithEvent:(UIEvent *)touchEvent; +- (void)cancelTrackingWithEvent:(nullable UIEvent *)touchEvent; /** @abstract Sent to the control when the last touch completely ends, telling it to stop tracking. @param touch The touch that ended. @param touchEvent An event object encapsulating the information specific to the user event. */ -- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)touchEvent; +- (void)endTrackingWithTouch:(nullable UITouch *)touch withEvent:(nullable UIEvent *)touchEvent; /** @abstract Settable version of highlighted property. @@ -61,3 +62,5 @@ @property (nonatomic, readwrite, assign, getter=isHighlighted) BOOL highlighted; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASControlNode.h b/AsyncDisplayKit/ASControlNode.h index d08a09c6..28a40ad5 100644 --- a/AsyncDisplayKit/ASControlNode.h +++ b/AsyncDisplayKit/ASControlNode.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN /** @abstract Kinds of events possible for control nodes. @@ -75,7 +76,7 @@ typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent) @param controlEvents A bitmask specifying the control events for which the action message is sent. May not be 0. See "Control Events" for bitmask constants. @discussion You may call this method multiple times, and you may specify multiple target-action pairs for a particular event. Targets are held weakly. */ -- (void)addTarget:(id)target action:(SEL)action forControlEvents:(ASControlNodeEvent)controlEvents; +- (void)addTarget:(nullable id)target action:(SEL)action forControlEvents:(ASControlNodeEvent)controlEvents; /** @abstract Returns the actions that are associated with a target and a particular control event. @@ -83,7 +84,7 @@ typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent) @param controlEvent A single constant of type ASControlNodeEvent that specifies a particular user action on the control; for a list of these constants, see "Control Events". May not be 0 or ASControlNodeEventAllEvents. @result An array of selector names as NSString objects, or nil if there are no action selectors associated with controlEvent. */ -- (NSArray *)actionsForTarget:(id)target forControlEvent:(ASControlNodeEvent)controlEvent; +- (nullable NSArray *)actionsForTarget:(id)target forControlEvent:(ASControlNodeEvent)controlEvent; /** @abstract Returns all target objects associated with the receiver. @@ -97,13 +98,15 @@ typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent) @param action A selector identifying an action message. Pass NULL to remove all action messages paired with target. @param controlEvents A bitmask specifying the control events associated with target and action. See "Control Events" for bitmask constants. May not be 0. */ -- (void)removeTarget:(id)target action:(SEL)action forControlEvents:(ASControlNodeEvent)controlEvents; +- (void)removeTarget:(nullable id)target action:(nullable SEL)action forControlEvents:(ASControlNodeEvent)controlEvents; /** @abstract Sends the actions for the control events for a particular event. @param controlEvents A bitmask specifying the control events for which to send actions. See "Control Events" for bitmask constants. May not be 0. @param event The event which triggered these control actions. May be nil. */ -- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(UIEvent *)event; +- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)event; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASDisplayNode+Subclasses.h b/AsyncDisplayKit/ASDisplayNode+Subclasses.h index 108dbdd3..7d002934 100644 --- a/AsyncDisplayKit/ASDisplayNode+Subclasses.h +++ b/AsyncDisplayKit/ASDisplayNode+Subclasses.h @@ -15,6 +15,8 @@ @class ASLayoutSpec; +NS_ASSUME_NONNULL_BEGIN + /** * The subclass header _ASDisplayNode+Subclasses_ defines the following methods that either must or can be overriden by * subclasses of ASDisplayNode. @@ -58,7 +60,7 @@ * * @warning Subclasses must not override this; it returns the last cached layout and is never expensive. */ -@property (nonatomic, readonly, assign) ASLayout *calculatedLayout; +@property (nullable, nonatomic, readonly, assign) ASLayout *calculatedLayout; /** @name View Lifecycle */ @@ -163,7 +165,7 @@ * * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) */ -+ (void)drawRect:(CGRect)bounds withParameters:(id)parameters ++ (void)drawRect:(CGRect)bounds withParameters:(nullable id )parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing; @@ -180,7 +182,7 @@ * * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) */ -+ (UIImage *)displayWithParameters:(id)parameters ++ (nullable UIImage *)displayWithParameters:(nullable id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock; /** @@ -190,7 +192,7 @@ * * @note Called on the main thread only */ -- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer; +- (nullable id)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer; /** * @abstract Indicates that the receiver is about to display. @@ -331,7 +333,7 @@ * @param touches A set of UITouch instances. * @param event A UIEvent associated with the touch. */ -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event; /** * @abstract Tells the node when touches moved in its view. @@ -339,7 +341,7 @@ * @param touches A set of UITouch instances. * @param event A UIEvent associated with the touch. */ -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event; /** * @abstract Tells the node when touches ended in its view. @@ -347,7 +349,7 @@ * @param touches A set of UITouch instances. * @param event A UIEvent associated with the touch. */ -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event; /** * @abstract Tells the node when touches was cancelled in its view. @@ -355,7 +357,7 @@ * @param touches A set of UITouch instances. * @param event A UIEvent associated with the touch. */ -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event; /** @name Managing Gesture Recognizers */ @@ -385,7 +387,7 @@ * 1) allows sending events to plain UIViews that don't have attached nodes, * 2) hitTest: is never called before the views are created. */ -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event; +- (nullable UIView *)hitTest:(CGPoint)point withEvent:(nullable UIEvent *)event; /** @name Placeholders */ @@ -404,7 +406,7 @@ * * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) */ -- (UIImage *)placeholderImage; +- (nullable UIImage *)placeholderImage; /** @name Description */ @@ -420,3 +422,5 @@ #define ASDisplayNodeAssertThreadAffinity(viewNode) ASDisplayNodeAssert(!viewNode || ASDisplayNodeThreadIsMain() || !(viewNode).nodeLoaded, @"Incorrect display node thread affinity - this method should not be called off the main thread after the ASDisplayNode's view or layer have been created") #define ASDisplayNodeCAssertThreadAffinity(viewNode) ASDisplayNodeCAssert(!viewNode || ASDisplayNodeThreadIsMain() || !(viewNode).nodeLoaded, @"Incorrect display node thread affinity - this method should not be called off the main thread after the ASDisplayNode's view or layer have been created") + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASDisplayNode.h b/AsyncDisplayKit/ASDisplayNode.h index b18ce141..cad8539a 100644 --- a/AsyncDisplayKit/ASDisplayNode.h +++ b/AsyncDisplayKit/ASDisplayNode.h @@ -15,22 +15,24 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + @class ASDisplayNode; /** * UIView creation block. Used to create the backing view of a new display node. */ -typedef UIView *(^ASDisplayNodeViewBlock)(); +typedef UIView * _Nonnull(^ASDisplayNodeViewBlock)(); /** * UIView creation block. Used to create the backing view of a new display node. */ -typedef UIViewController *(^ASDisplayNodeViewControllerBlock)(); +typedef UIViewController * _Nonnull(^ASDisplayNodeViewControllerBlock)(); /** * CALayer creation block. Used to create the backing layer of a new display node. */ -typedef CALayer *(^ASDisplayNodeLayerBlock)(); +typedef CALayer * _Nonnull(^ASDisplayNodeLayerBlock)(); /** * ASDisplayNode loaded callback block. This block is called BEFORE the -didLoad method and is always called on the main thread. @@ -96,7 +98,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * @return An ASDisplayNode instance whose view will be a subclass that enables asynchronous rendering, and passes * through -layout and touch handling methods. */ -- (id)init; +- (instancetype)init; /** @@ -107,7 +109,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * @return An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main * queue. The view will render synchronously and -layout and touch handling methods on the node will not be called. */ -- (id)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock; +- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock; /** * @abstract Alternative initializer with a block to create the backing view. @@ -118,7 +120,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * @return An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main * queue. The view will render synchronously and -layout and touch handling methods on the node will not be called. */ -- (id)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock; +- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock; /** * @abstract Alternative initializer with a block to create the backing layer. @@ -128,7 +130,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * @return An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main * queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called. */ -- (id)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock; +- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock; /** * @abstract Alternative initializer with a block to create the backing layer. @@ -139,7 +141,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * @return An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main * queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called. */ -- (id)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock; +- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock; /** @name Properties */ @@ -147,7 +149,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) /** * @abstract The name of this node, which will be displayed in `description`. The default value is nil. */ -@property (atomic, copy) NSString *name; +@property (nullable, atomic, copy) NSString *name; /** * @abstract Returns whether the node is synchronous. @@ -341,7 +343,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) /** * @abstract The receiver's immediate subnodes. */ -@property (nonatomic, readonly, retain) NSArray *subnodes; +@property (nonatomic, readonly, retain) NSArray *subnodes; /** * @abstract The receiver's supernode. @@ -500,7 +502,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * * @return YES if point is inside the receiver's bounds; otherwise, NO. */ -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event; +- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event; /** @name Converting Between View Coordinate Systems */ @@ -514,7 +516,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * * @return The point converted to the coordinate system of node. */ -- (CGPoint)convertPoint:(CGPoint)point toNode:(ASDisplayNode *)node; +- (CGPoint)convertPoint:(CGPoint)point toNode:(nullable ASDisplayNode *)node; /** @@ -525,7 +527,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * * @return The point converted to the local coordinate system (bounds) of the receiver. */ -- (CGPoint)convertPoint:(CGPoint)point fromNode:(ASDisplayNode *)node; +- (CGPoint)convertPoint:(CGPoint)point fromNode:(nullable ASDisplayNode *)node; /** @@ -536,7 +538,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * * @return The converted rectangle. */ -- (CGRect)convertRect:(CGRect)rect toNode:(ASDisplayNode *)node; +- (CGRect)convertRect:(CGRect)rect toNode:(nullable ASDisplayNode *)node; /** * @abstract Converts a rectangle from the coordinate system of another node to that of the receiver. @@ -546,7 +548,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * * @return The converted rectangle. */ -- (CGRect)convertRect:(CGRect)rect fromNode:(ASDisplayNode *)node; +- (CGRect)convertRect:(CGRect)rect fromNode:(nullable ASDisplayNode *)node; @end @@ -625,9 +627,9 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) * @discussion In contrast to UIView, setting a transparent color will not set opaque = NO. * This only affects nodes that implement +drawRect like ASTextNode. */ -@property (atomic, retain) UIColor *backgroundColor; // default=nil +@property (atomic, retain, nullable) UIColor *backgroundColor; // default=nil -@property (atomic, retain) UIColor *tintColor; // default=Blue +@property (atomic, retain, null_resettable) UIColor *tintColor; // default=Blue - (void)tintColorDidChange; // Notifies the node when the tintColor has changed. /** @@ -660,18 +662,18 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) // Accessibility support @property (atomic, assign) BOOL isAccessibilityElement; -@property (atomic, copy) NSString *accessibilityLabel; -@property (atomic, copy) NSString *accessibilityHint; -@property (atomic, copy) NSString *accessibilityValue; +@property (nullable, atomic, copy) NSString *accessibilityLabel; +@property (nullable, atomic, copy) NSString *accessibilityHint; +@property (nullable, atomic, copy) NSString *accessibilityValue; @property (atomic, assign) UIAccessibilityTraits accessibilityTraits; @property (atomic, assign) CGRect accessibilityFrame; -@property (atomic, retain) NSString *accessibilityLanguage; +@property (nullable, atomic, retain) NSString *accessibilityLanguage; @property (atomic, assign) BOOL accessibilityElementsHidden; @property (atomic, assign) BOOL accessibilityViewIsModal; @property (atomic, assign) BOOL shouldGroupAccessibilityChildren; // Accessibility identification support -@property (nonatomic, copy) NSString *accessibilityIdentifier; +@property (nullable, nonatomic, copy) NSString *accessibilityIdentifier; @end @@ -702,6 +704,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) - (void)addSubnode:(ASDisplayNode *)node; @end + @interface ASDisplayNode (Deprecated) - (void)reclaimMemory ASDISPLAYNODE_DEPRECATED; @@ -709,3 +712,5 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) @property (nonatomic, assign) BOOL placeholderFadesOut ASDISPLAYNODE_DEPRECATED; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm index 52f38cda..19c972f7 100644 --- a/AsyncDisplayKit/ASDisplayNode.mm +++ b/AsyncDisplayKit/ASDisplayNode.mm @@ -6,7 +6,6 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#import "ASDisplayNode.h" #import "ASDisplayNodeInternal.h" #import "ASDisplayNode+Subclasses.h" #import "ASDisplayNode+FrameworkPrivate.h" @@ -49,6 +48,9 @@ #define TIME_SCOPED(outVar) #endif +@interface ASDisplayNode () <_ASDisplayLayerDelegate> +@end + @implementation ASDisplayNode // these dynamic properties all defined in ASLayoutOptionsPrivate.m diff --git a/AsyncDisplayKit/ASDisplayNodeExtras.h b/AsyncDisplayKit/ASDisplayNodeExtras.h index 22dc2f29..e8e72c73 100644 --- a/AsyncDisplayKit/ASDisplayNodeExtras.h +++ b/AsyncDisplayKit/ASDisplayNodeExtras.h @@ -12,17 +12,19 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + ASDISPLAYNODE_EXTERN_C_BEGIN /** Given a layer, returns the associated display node, if any. */ -extern ASDisplayNode *ASLayerToDisplayNode(CALayer *layer); +extern ASDisplayNode * _Nullable ASLayerToDisplayNode(CALayer * _Nullable layer); /** Given a view, returns the associated display node, if any. */ -extern ASDisplayNode *ASViewToDisplayNode(UIView *view); +extern ASDisplayNode * _Nullable ASViewToDisplayNode(UIView * _Nullable view); /** Given a node, returns the root of the node heirarchy (where supernode == nil) @@ -35,7 +37,7 @@ extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node); In the event that a node's backing layer is not created yet, the function will only walk the direct subnodes instead of forcing the layer heirarchy to be created. */ -extern void ASDisplayNodePerformBlockOnEveryNode(CALayer *layer, ASDisplayNode *node, void(^block)(ASDisplayNode *node)); +extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, void(^block)(ASDisplayNode *node)); /** Identical to ASDisplayNodePerformBlockOnEveryNode, except it does not run the block on the @@ -46,12 +48,12 @@ extern void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, void(^b /** Given a display node, traverses up the layer tree hierarchy, returning the first display node that passes block. */ -extern id ASDisplayNodeFind(ASDisplayNode *node, BOOL (^block)(ASDisplayNode *node)); +extern id _Nullable ASDisplayNodeFind(ASDisplayNode * _Nullable node, BOOL (^block)(ASDisplayNode *node)); /** Given a display node, traverses up the layer tree hierarchy, returning the first display node of kind class. */ -extern id ASDisplayNodeFindClass(ASDisplayNode *start, Class c); +extern id _Nullable ASDisplayNodeFindClass(ASDisplayNode *start, Class c); /** * Given two nodes, finds their most immediate common parent. Used for geometry conversion methods. @@ -61,32 +63,32 @@ extern id ASDisplayNodeFindClass(ASDisplayNode *start, Class c); * undefined and undocumented behavior of UIKit in ASDisplayNode, this operation is defined to be incorrect in all * circumstances and must be fixed wherever encountered. */ -extern ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2); +extern ASDisplayNode * _Nullable ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2); /** Given a display node, collects all descendents. This is a specialization of ASCollectContainer() that walks the Core Animation layer tree as opposed to the display node tree, thus supporting non-continues display node hierarchies. */ -extern NSArray *ASCollectDisplayNodes(ASDisplayNode *node); +extern NSArray *ASCollectDisplayNodes(ASDisplayNode *node); /** Given a display node, traverses down the node hierarchy, returning all the display nodes that pass the block. */ -extern NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)); +extern NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)); /** Given a display node, traverses down the node hierarchy, returning all the display nodes of kind class. */ -extern NSArray *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c); +extern NSArray *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c); /** Given a display node, traverses down the node hierarchy, returning the depth-first display node that pass the block. */ -extern id ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)); +extern __kindof ASDisplayNode * ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)); /** Given a display node, traverses down the node hierarchy, returning the depth-first display node of kind class. */ -extern id ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c); +extern __kindof ASDisplayNode * ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c); extern UIColor *ASDisplayNodeDefaultPlaceholderColor(); extern UIColor *ASDisplayNodeDefaultTintColor(); @@ -98,3 +100,5 @@ extern void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); extern void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); ASDISPLAYNODE_EXTERN_C_END + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASDisplayNodeExtras.mm b/AsyncDisplayKit/ASDisplayNodeExtras.mm index 7665bee9..709f3c18 100644 --- a/AsyncDisplayKit/ASDisplayNodeExtras.mm +++ b/AsyncDisplayKit/ASDisplayNodeExtras.mm @@ -87,7 +87,7 @@ static void _ASCollectDisplayNodes(NSMutableArray *array, CALayer *layer) _ASCollectDisplayNodes(array, sublayer); } -extern NSArray *ASCollectDisplayNodes(ASDisplayNode *node) +extern NSArray *ASCollectDisplayNodes(ASDisplayNode *node) { NSMutableArray *list = [NSMutableArray array]; for (CALayer *sublayer in node.layer.sublayers) { @@ -112,14 +112,14 @@ static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode * } } -extern NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) +extern NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) { NSMutableArray *list = [NSMutableArray array]; _ASDisplayNodeFindAllSubnodes(list, start, block); return list; } -extern NSArray *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) +extern NSArray *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) { return ASDisplayNodeFindAllSubnodes(start, ^(ASDisplayNode *n) { return [n isKindOfClass:c]; @@ -143,12 +143,12 @@ static ASDisplayNode *_ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, B return nil; } -extern id ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) +extern __kindof ASDisplayNode * ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) { return _ASDisplayNodeFindFirstSubnode(startNode, NO, block); } -extern id ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) +extern __kindof ASDisplayNode * ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) { return ASDisplayNodeFindFirstSubnode(start, ^(ASDisplayNode *n) { return [n isKindOfClass:c]; diff --git a/AsyncDisplayKit/ASEditableTextNode.h b/AsyncDisplayKit/ASEditableTextNode.h index ee20ce80..fff4a6d8 100644 --- a/AsyncDisplayKit/ASEditableTextNode.h +++ b/AsyncDisplayKit/ASEditableTextNode.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN @protocol ASEditableTextNodeDelegate; @@ -29,7 +30,7 @@ @property (nonatomic, readonly, strong) UITextView *textView; //! @abstract The attributes to apply to new text being entered by the user. -@property (nonatomic, readwrite, strong) NSDictionary *typingAttributes; +@property (nonatomic, readwrite, strong) NSDictionary *typingAttributes; //! @abstract The range of text currently selected. If length is zero, the range is the cursor location. @property (nonatomic, readwrite, assign) NSRange selectedRange; @@ -144,3 +145,5 @@ @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASImageNode.h b/AsyncDisplayKit/ASImageNode.h index 8f71a066..2afdcbda 100644 --- a/AsyncDisplayKit/ASImageNode.h +++ b/AsyncDisplayKit/ASImageNode.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN /** * Image modification block. Use to transform an image before display. @@ -16,7 +17,7 @@ * * @returns A transformed image. */ -typedef UIImage *(^asimagenode_modification_block_t)(UIImage *image); +typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image); /** @@ -32,12 +33,12 @@ typedef UIImage *(^asimagenode_modification_block_t)(UIImage *image); * the layer's contentsCenter property. Non-stretchable images work too, of * course. */ -@property (atomic, retain) UIImage *image; +@property (nullable, atomic, retain) UIImage *image; /** @abstract The placeholder color. */ -@property (nonatomic, strong) UIColor *placeholderColor; +@property (nullable, nonatomic, strong) UIColor *placeholderColor; /** * @abstract Indicates whether efficient cropping of the receiver is enabled. @@ -85,7 +86,7 @@ typedef UIImage *(^asimagenode_modification_block_t)(UIImage *image); * @discussion Can be used to add image effects (such as rounding, adding * borders, or other pattern overlays) without extraneous display calls. */ -@property (nonatomic, readwrite, copy) asimagenode_modification_block_t imageModificationBlock; +@property (nullable, nonatomic, readwrite, copy) asimagenode_modification_block_t imageModificationBlock; /** * @abstract Marks the receiver as needing display and performs a block after @@ -99,7 +100,7 @@ typedef UIImage *(^asimagenode_modification_block_t)(UIImage *image); * `displaySuspended` is YES, `displayCompletionBlock` is will be * performed immediately and `YES` will be passed for `canceled`. */ -- (void)setNeedsDisplayWithCompletion:(void (^)(BOOL canceled))displayCompletionBlock; +- (void)setNeedsDisplayWithCompletion:(void (^ _Nullable)(BOOL canceled))displayCompletionBlock; @end @@ -131,3 +132,4 @@ asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color); ASDISPLAYNODE_EXTERN_C_END +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASImageNode.mm b/AsyncDisplayKit/ASImageNode.mm index 3de85556..3191b53a 100644 --- a/AsyncDisplayKit/ASImageNode.mm +++ b/AsyncDisplayKit/ASImageNode.mm @@ -267,7 +267,7 @@ } #pragma mark - -- (void)setNeedsDisplayWithCompletion:(void (^)(BOOL canceled))displayCompletionBlock +- (void)setNeedsDisplayWithCompletion:(void (^ _Nullable)(BOOL canceled))displayCompletionBlock { if (self.displaySuspended) { if (displayCompletionBlock) diff --git a/AsyncDisplayKit/ASMapNode.h b/AsyncDisplayKit/ASMapNode.h index bd2d23ad..0a8b0ebb 100644 --- a/AsyncDisplayKit/ASMapNode.h +++ b/AsyncDisplayKit/ASMapNode.h @@ -6,9 +6,11 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#import +#import #import +NS_ASSUME_NONNULL_BEGIN + @interface ASMapNode : ASImageNode /** @@ -19,7 +21,7 @@ /** This is the MKMapView that is the live map part of ASMapNode. This will be nil if .liveMap = NO. Note, MKMapView is *not* thread-safe. */ -@property (nonatomic, readonly) MKMapView *mapView; +@property (nullable, nonatomic, readonly) MKMapView *mapView; /** Set this to YES to turn the snapshot into an interactive MKMapView and vice versa. Defaults to NO. This property may be set on a background thread before the node is loaded, and will automatically be actioned, once the node is loaded. @@ -41,6 +43,8 @@ * @discussion This method set the annotations of the static map view and also to the live map view. Passing an empty array clears the map of any annotations. * @param annotations An array of objects that conform to the MKAnnotation protocol */ -- (void)setAnnotations:(NSArray *)annotations; +- (void)setAnnotations:(NSArray> *)annotations; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASMapNode.mm b/AsyncDisplayKit/ASMapNode.mm index 480360a1..ce4f3fc8 100644 --- a/AsyncDisplayKit/ASMapNode.mm +++ b/AsyncDisplayKit/ASMapNode.mm @@ -7,6 +7,8 @@ */ #import "ASMapNode.h" +#import +#import #import #import #import diff --git a/AsyncDisplayKit/ASMultiplexImageNode.h b/AsyncDisplayKit/ASMultiplexImageNode.h index cf9b283a..25e463b2 100644 --- a/AsyncDisplayKit/ASMultiplexImageNode.h +++ b/AsyncDisplayKit/ASMultiplexImageNode.h @@ -11,9 +11,13 @@ #import +NS_ASSUME_NONNULL_BEGIN + @protocol ASMultiplexImageNodeDelegate; @protocol ASMultiplexImageNodeDataSource; +typedef id ASImageIdentifier; + extern NSString *const ASMultiplexImageNodeErrorDomain; /** @@ -50,8 +54,7 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { * @abstract ASMultiplexImageNode is an image node that can load and display multiple versions of an image. For * example, it can display a low-resolution version of an image while the high-resolution version is loading. * - * @discussion ASMultiplexImageNode begins loading images when its property is set. For each image - * identifier, the data source can either return a UIImage directly, or a URL the image node should load. + * @discussion ASMultiplexImageNode begins loading images when its )cache downloader:(id)downloader NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithCache:(nullable id)cache downloader:(nullable id)downloader NS_DESIGNATED_INITIALIZER; /** * @abstract The delegate, which must conform to the protocol. @@ -92,10 +95,10 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { * * @see for more information on the image loading process. */ -@property (nonatomic, readwrite, copy) NSArray *imageIdentifiers; +@property (nonatomic, readwrite, copy) NSArray *imageIdentifiers; /** - * @abstract Notify the receiver that its data source has new UIImages or NSURLs available for . + * @abstract Notify the receiver SSAAthat its data source has new UIImages or NSURLs available for . * * @discussion If a higher-quality image than is currently displayed is now available, it will be loaded. */ @@ -106,12 +109,12 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { * * @discussion This value may differ from if the image hasn't yet been displayed. */ -@property (nonatomic, readonly) id loadedImageIdentifier; +@property (nullable, nonatomic, readonly) ASImageIdentifier loadedImageIdentifier; /** * @abstract The identifier for the image that the receiver is currently displaying, or nil. */ -@property (nonatomic, readonly) id displayedImageIdentifier; +@property (nullable, nonatomic, readonly) ASImageIdentifier displayedImageIdentifier; /** * @abstract The image manager that this image node should use when requesting images from the Photos framework. If this is `nil` (the default), then `PHImageManager.defaultManager` is used. @@ -146,7 +149,7 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { */ - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didUpdateDownloadProgress:(CGFloat)downloadProgress - forImageWithIdentifier:(id)imageIdentifier; + forImageWithIdentifier:(ASImageIdentifier)imageIdentifier; /** * @abstract Notification that the image node's download has finished. @@ -155,8 +158,8 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { * @param error The error that occurred while downloading, if one occurred; nil otherwise. */ - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode -didFinishDownloadingImageWithIdentifier:(id)imageIdentifier - error:(NSError *)error; +didFinishDownloadingImageWithIdentifier:(ASImageIdentifier)imageIdentifier + error:(nullable NSError *)error; /** * @abstract Notification that the image node's image was updated. @@ -169,10 +172,10 @@ didFinishDownloadingImageWithIdentifier:(id)imageIdentifier * @see <[ASMultiplexImageNodeDelegate multiplexImageNode:didDisplayUpdatedImage:withIdentifier:]>. */ - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode - didUpdateImage:(UIImage *)image - withIdentifier:(id)imageIdentifier - fromImage:(UIImage *)previousImage - withIdentifier:(id)previousImageIdentifier; + didUpdateImage:(nullable UIImage *)image + withIdentifier:(nullable ASImageIdentifier)imageIdentifier + fromImage:(nullable UIImage *)previousImage + withIdentifier:(nullable ASImageIdentifier)previousImageIdentifier; /** * @abstract Notification that the image node displayed a new image. @@ -182,8 +185,8 @@ didFinishDownloadingImageWithIdentifier:(id)imageIdentifier * @discussion This method is only called when `image` changes, and not on subsequent redisplays of the same image. */ - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode - didDisplayUpdatedImage:(UIImage *)image - withIdentifier:(id)imageIdentifier; + didDisplayUpdatedImage:(nullable UIImage *)image + withIdentifier:(nullable ASImageIdentifier)imageIdentifier; /** * @abstract Notification that the image node finished displaying an image. @@ -211,7 +214,7 @@ didFinishDownloadingImageWithIdentifier:(id)imageIdentifier * URL to the image via -multiplexImageNode:URLForImageIdentifier:. * @returns A UIImage corresponding to `imageIdentifier`, or nil if none is available. */ -- (UIImage *)multiplexImageNode:(ASMultiplexImageNode *)imageNode imageForImageIdentifier:(id)imageIdentifier; +- (nullable UIImage *)multiplexImageNode:(ASMultiplexImageNode *)imageNode imageForImageIdentifier:(ASImageIdentifier)imageIdentifier; /** * @abstract An image URL for the specified identifier. @@ -224,7 +227,7 @@ didFinishDownloadingImageWithIdentifier:(id)imageIdentifier * @return An NSURL for the image identified by `imageIdentifier`, or nil if none is available. * @see `+[NSURL URLWithAssetLocalIdentifier:targetSize:contentMode:options:]` below. */ -- (NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(id)imageIdentifier; +- (nullable NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(ASImageIdentifier)imageIdentifier; /** * @abstract A PHAsset for the specific asset local identifier @@ -236,7 +239,7 @@ didFinishDownloadingImageWithIdentifier:(id)imageIdentifier * @note This method may be called from any thread. * @return A PHAsset corresponding to `assetLocalIdentifier`, or nil if none is available. */ -- (PHAsset *)multiplexImageNode:(ASMultiplexImageNode *)imageNode assetForLocalIdentifier:(NSString *)assetLocalIdentifier; +- (nullable PHAsset *)multiplexImageNode:(ASMultiplexImageNode *)imageNode assetForLocalIdentifier:(NSString *)assetLocalIdentifier; @end @@ -257,4 +260,6 @@ didFinishDownloadingImageWithIdentifier:(id)imageIdentifier contentMode:(PHImageContentMode)contentMode options:(PHImageRequestOptions *)options; -@end \ No newline at end of file +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/ASNetworkImageNode.h b/AsyncDisplayKit/ASNetworkImageNode.h index c37d215d..1d7134ca 100644 --- a/AsyncDisplayKit/ASNetworkImageNode.h +++ b/AsyncDisplayKit/ASNetworkImageNode.h @@ -9,6 +9,7 @@ #import #import +NS_ASSUME_NONNULL_BEGIN @protocol ASNetworkImageNodeDelegate; @@ -32,7 +33,7 @@ * * @returns An initialized ASNetworkImageNode. */ -- (instancetype)initWithCache:(id)cache downloader:(id)downloader; +- (instancetype)initWithCache:(nullable id)cache downloader:(id)downloader NS_DESIGNATED_INITIALIZER; /** * Convenience initialiser. @@ -49,14 +50,14 @@ /** * A placeholder image to display while the URL is loading. */ -@property (atomic, strong, readwrite) UIImage *defaultImage; +@property (nullable, atomic, strong, readwrite) UIImage *defaultImage; /** * The URL of a new image to download and display. * * @discussion Changing this property will reset the displayed image to a placeholder () while loading. */ -@property (atomic, strong, readwrite) NSURL *URL; +@property (nullable, atomic, strong, readwrite) NSURL *URL; /** * Download and display a new image. @@ -65,7 +66,7 @@ * * @param reset Whether to display a placeholder () while loading the new image. */ -- (void)setURL:(NSURL *)URL resetToDefault:(BOOL)reset; +- (void)setURL:(nullable NSURL *)URL resetToDefault:(BOOL)reset; /** * If is a local file, set this property to YES to take advantage of UIKit's image cacheing. Defaults to YES. @@ -102,3 +103,5 @@ - (void)imageNodeDidFinishDecoding:(ASNetworkImageNode *)imageNode; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASPagerNode.m b/AsyncDisplayKit/ASPagerNode.m index d4537d0a..b8a52f73 100644 --- a/AsyncDisplayKit/ASPagerNode.m +++ b/AsyncDisplayKit/ASPagerNode.m @@ -8,8 +8,7 @@ #import "ASPagerNode.h" #import "ASDelegateProxy.h" - -#import +#import "ASDisplayNode+Subclasses.h" @interface ASPagerNode () { UICollectionViewFlowLayout *_flowLayout; diff --git a/AsyncDisplayKit/ASScrollNode.h b/AsyncDisplayKit/ASScrollNode.h index a53090bd..32733ffe 100644 --- a/AsyncDisplayKit/ASScrollNode.h +++ b/AsyncDisplayKit/ASScrollNode.h @@ -10,6 +10,7 @@ #import +NS_ASSUME_NONNULL_BEGIN /** * Simple node that wraps UIScrollView. @@ -22,3 +23,5 @@ @property (nonatomic, readonly, strong) UIScrollView *view; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASTableNode.h b/AsyncDisplayKit/ASTableNode.h index 9ab36470..13d5c88f 100644 --- a/AsyncDisplayKit/ASTableNode.h +++ b/AsyncDisplayKit/ASTableNode.h @@ -6,7 +6,7 @@ // Copyright © 2015 Facebook. All rights reserved. // -#import +#import /** * ASTableNode is a node based class that wraps an ASTableView. It can be used diff --git a/AsyncDisplayKit/ASTableNode.m b/AsyncDisplayKit/ASTableNode.m index f45f742d..2917b73c 100644 --- a/AsyncDisplayKit/ASTableNode.m +++ b/AsyncDisplayKit/ASTableNode.m @@ -6,7 +6,9 @@ // Copyright © 2015 Facebook. All rights reserved. // +#import "ASFlowLayoutController.h" #import "ASTableNode.h" +#import "ASDisplayNode+Subclasses.h" @interface _ASTablePendingState : NSObject @property (weak, nonatomic) id delegate; diff --git a/AsyncDisplayKit/ASTableView.h b/AsyncDisplayKit/ASTableView.h index 410b073f..d3e2b05b 100644 --- a/AsyncDisplayKit/ASTableView.h +++ b/AsyncDisplayKit/ASTableView.h @@ -12,6 +12,8 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + @class ASCellNode; @protocol ASTableDataSource; @protocol ASTableDelegate; @@ -81,7 +83,7 @@ * the main thread. * @warning This method is substantially more expensive than UITableView's version. */ --(void)reloadDataWithCompletion:(void (^)())completion; +-(void)reloadDataWithCompletion:(void (^ _Nullable)())completion; /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -125,7 +127,7 @@ * Boolean parameter that contains the value YES if all of the related animations completed successfully or * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. */ -- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL completed))completion; +- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^ _Nullable)(BOOL completed))completion; /** * Inserts one or more sections, with an option to animate the insertion. @@ -185,7 +187,7 @@ * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes * before this method is called. */ -- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; +- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; /** * Deletes the rows specified by an array of index paths, with an option to animate the deletion. @@ -197,7 +199,7 @@ * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes * before this method is called. */ -- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; +- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; /** * Reloads the specified rows using a given animation effect. @@ -209,7 +211,7 @@ * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes * before this method is called. */ -- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; +- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; /** * Moves the row at a specified location to a destination location. @@ -239,14 +241,14 @@ * * @returns an indexPath for this cellNode */ -- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode; +- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode; /** * Similar to -visibleCells. * * @returns an array containing the nodes being displayed on screen. */ -- (NSArray *)visibleNodes; +- (NSArray *)visibleNodes; /** * YES to automatically adjust the contentOffset when cells are inserted or deleted "before" @@ -328,7 +330,7 @@ @optional - (void)tableView:(ASTableView *)tableView willDisplayNodeForRowAtIndexPath:(NSIndexPath *)indexPath; -- (void)tableView:(ASTableView *)tableView didEndDisplayingNodeForRowAtIndexPath:(NSIndexPath*)indexPath; +- (void)tableView:(ASTableView *)tableView didEndDisplayingNodeForRowAtIndexPath:(NSIndexPath *)indexPath; /** * Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary. @@ -359,5 +361,7 @@ @end -@protocol ASTableViewDelegate ; +@protocol ASTableViewDelegate @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASTableView.mm b/AsyncDisplayKit/ASTableView.mm index a5e65178..b2f6457f 100644 --- a/AsyncDisplayKit/ASTableView.mm +++ b/AsyncDisplayKit/ASTableView.mm @@ -6,9 +6,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#import "ASTableView.h" #import "ASTableViewInternal.h" -#import "ASTableNode.h" #import "ASAssert.h" #import "ASBatchFetching.h" diff --git a/AsyncDisplayKit/ASTableViewInternal.h b/AsyncDisplayKit/ASTableViewInternal.h index af940837..8d43beaf 100644 --- a/AsyncDisplayKit/ASTableViewInternal.h +++ b/AsyncDisplayKit/ASTableViewInternal.h @@ -6,7 +6,7 @@ // Copyright (c) 2015 Facebook. All rights reserved. // -#import "ASTableView.h" +#import "ASTableNode.h" @class ASDataController; diff --git a/AsyncDisplayKit/ASTableViewProtocols.h b/AsyncDisplayKit/ASTableViewProtocols.h index 84458179..df8bb811 100644 --- a/AsyncDisplayKit/ASTableViewProtocols.h +++ b/AsyncDisplayKit/ASTableViewProtocols.h @@ -6,6 +6,8 @@ * of patent rights can be found in the PATENTS file in the same directory. */ +NS_ASSUME_NONNULL_BEGIN + /** * This is a subset of UITableViewDataSource. * @@ -21,14 +23,14 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; -- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; -- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section; +- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; +- (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section; - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath; -- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView; +- (nullable NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView; - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index; - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath; @@ -55,8 +57,8 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section; - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section; -- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; -- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; +- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; +- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath; @@ -64,14 +66,14 @@ - (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath; -- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath; -- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath; +- (nullable NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath; +- (nullable NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath; - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; -- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath; -- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath; +- (nullable NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath; +- (nullable NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath; @@ -83,7 +85,9 @@ - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath; -- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender; -- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender; +- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender; +- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASTextNode.h b/AsyncDisplayKit/ASTextNode.h index 1a47f3d7..8014db0f 100644 --- a/AsyncDisplayKit/ASTextNode.h +++ b/AsyncDisplayKit/ASTextNode.h @@ -8,6 +8,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + @protocol ASTextNodeDelegate; /** @@ -36,7 +38,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { @discussion Defaults to nil, no text is shown. For inline image attachments, add an attribute of key NSAttachmentAttributeName, with a value of an NSTextAttachment. */ -@property (nonatomic, copy) NSAttributedString *attributedString; +@property (nullable, nonatomic, copy) NSAttributedString *attributedString; #pragma mark - Truncation @@ -44,14 +46,14 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { @abstract The attributedString to use when the text must be truncated. @discussion Defaults to a localized ellipsis character. */ -@property (nonatomic, copy) NSAttributedString *truncationAttributedString; +@property (nullable, nonatomic, copy) NSAttributedString *truncationAttributedString; /** @summary The second attributed string appended for truncation. @discussion This string will be highlighted on touches. @default nil */ -@property (nonatomic, copy) NSAttributedString *additionalTruncationMessage; +@property (nullable, nonatomic, copy) NSAttributedString *additionalTruncationMessage; /** @abstract Determines how the text is truncated to fit within the receiver's maximum size. @@ -75,7 +77,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { */ @property (nonatomic, readonly, assign) NSUInteger lineCount; -@property (nonatomic, strong) NSArray *exclusionPaths; +@property (nullable, nonatomic, strong) NSArray *exclusionPaths; #pragma mark - Placeholders @@ -91,7 +93,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { /** @abstract The placeholder color. */ -@property (nonatomic, strong) UIColor *placeholderColor; +@property (nullable, nonatomic, strong) UIColor *placeholderColor; /** @abstract Inset each line of the placeholder. @@ -127,7 +129,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { a line break, the rects returned will be on opposite sides and different lines). The rects returned are in the coordinate system of the receiver. */ -- (NSArray *)rectsForTextRange:(NSRange)textRange; +- (NSArray *)rectsForTextRange:(NSRange)textRange; /** @abstract Returns an array of rects used for highlighting the characters in a given text range. @@ -138,7 +140,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { are in the coordinate system of the receiver. This method is useful for visual coordination with a highlighted range of text. */ -- (NSArray *)highlightRectsForTextRange:(NSRange)textRange; +- (NSArray *)highlightRectsForTextRange:(NSRange)textRange; /** @abstract Returns a bounding rect for the given text range. @@ -162,7 +164,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { /** @abstract The set of attribute names to consider links. Defaults to NSLinkAttributeName. */ -@property (nonatomic, copy) NSArray *linkAttributeNames; +@property (nonatomic, copy) NSArray *linkAttributeNames; /** @abstract Indicates whether the receiver has an entity at a given point. @@ -171,7 +173,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { @param rangeOut The ultimate range of the found text. Can be NULL. @result YES if an entity exists at `point`; NO otherwise. */ -- (id)linkAttributeValueAtPoint:(CGPoint)point attributeName:(out NSString **)attributeNameOut range:(out NSRange *)rangeOut; +- (nullable id)linkAttributeValueAtPoint:(CGPoint)point attributeName:(out NSString * _Nullable * _Nullable)attributeNameOut range:(out NSRange * _Nullable)rangeOut; /** @abstract The style to use when highlighting text. @@ -267,3 +269,5 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { - (BOOL)textNode:(ASTextNode *)textNode shouldLongPressLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASViewController.h b/AsyncDisplayKit/ASViewController.h index 7ef1fdf7..74c674f6 100644 --- a/AsyncDisplayKit/ASViewController.h +++ b/AsyncDisplayKit/ASViewController.h @@ -9,6 +9,8 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + @interface ASViewController : UIViewController - (instancetype)initWithNode:(ASDisplayNode *)node NS_DESIGNATED_INITIALIZER; @@ -39,3 +41,5 @@ - (ASSizeRange)nodeConstrainedSize; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/ASViewController.m b/AsyncDisplayKit/ASViewController.m index 519ac4b3..96797855 100644 --- a/AsyncDisplayKit/ASViewController.m +++ b/AsyncDisplayKit/ASViewController.m @@ -18,12 +18,14 @@ - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - return [self initWithNode:nil]; + ASDisplayNodeAssert(NO, @"ASViewController requires using -initWithNode:"); + return [self initWithNode:[[ASDisplayNode alloc] init]]; } - (instancetype)initWithCoder:(NSCoder *)aDecoder { - return [self initWithNode:nil]; + ASDisplayNodeAssert(NO, @"ASViewController requires using -initWithNode:"); + return [self initWithNode:[[ASDisplayNode alloc] init]]; } - (instancetype)initWithNode:(ASDisplayNode *)node diff --git a/AsyncDisplayKit/AsyncDisplayKit.h b/AsyncDisplayKit/AsyncDisplayKit.h index 0cb9a32f..b854d756 100644 --- a/AsyncDisplayKit/AsyncDisplayKit.h +++ b/AsyncDisplayKit/AsyncDisplayKit.h @@ -52,8 +52,6 @@ #import #import #import -#import -#import #import #import #import diff --git a/AsyncDisplayKit/Details/ASAbstractLayoutController.h b/AsyncDisplayKit/Details/ASAbstractLayoutController.h index 7fcf36da..153379fa 100644 --- a/AsyncDisplayKit/Details/ASAbstractLayoutController.h +++ b/AsyncDisplayKit/Details/ASAbstractLayoutController.h @@ -9,6 +9,8 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + @interface ASAbstractLayoutController : NSObject - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType; @@ -16,3 +18,5 @@ - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASBasicImageDownloader.h b/AsyncDisplayKit/Details/ASBasicImageDownloader.h index 7f7a86c9..38b7b5a0 100644 --- a/AsyncDisplayKit/Details/ASBasicImageDownloader.h +++ b/AsyncDisplayKit/Details/ASBasicImageDownloader.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN /** * @abstract Simple NSURLSession-based image downloader. @@ -20,3 +21,5 @@ - (instancetype)init __attribute__((unavailable("+[ASBasicImageDownloader sharedImageDownloader] must be used."))); @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASBatchContext.h b/AsyncDisplayKit/Details/ASBatchContext.h index 94c42293..452582f9 100644 --- a/AsyncDisplayKit/Details/ASBatchContext.h +++ b/AsyncDisplayKit/Details/ASBatchContext.h @@ -8,6 +8,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + /** * @abstract A context object to notify when batch fetches are finished or cancelled. */ @@ -58,3 +60,5 @@ - (void)beginBatchFetching; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASCollectionViewFlowLayoutInspector.m b/AsyncDisplayKit/Details/ASCollectionViewFlowLayoutInspector.m index f98afbb9..61687308 100644 --- a/AsyncDisplayKit/Details/ASCollectionViewFlowLayoutInspector.m +++ b/AsyncDisplayKit/Details/ASCollectionViewFlowLayoutInspector.m @@ -9,7 +9,6 @@ #import #import "ASCollectionViewFlowLayoutInspector.h" - #import "ASCollectionView.h" #import "ASAssert.h" #import "ASEqualityHelpers.h" diff --git a/AsyncDisplayKit/Details/ASCollectionViewLayoutController.h b/AsyncDisplayKit/Details/ASCollectionViewLayoutController.h index 9aa25db0..632ba46b 100644 --- a/AsyncDisplayKit/Details/ASCollectionViewLayoutController.h +++ b/AsyncDisplayKit/Details/ASCollectionViewLayoutController.h @@ -9,6 +9,8 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + @class ASCollectionView; @interface ASCollectionViewLayoutController : ASAbstractLayoutController @@ -16,3 +18,5 @@ - (instancetype)initWithCollectionView:(ASCollectionView *)collectionView; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASDataController+Subclasses.h b/AsyncDisplayKit/Details/ASDataController+Subclasses.h index 23c28e9a..32d78791 100644 --- a/AsyncDisplayKit/Details/ASDataController+Subclasses.h +++ b/AsyncDisplayKit/Details/ASDataController+Subclasses.h @@ -6,7 +6,10 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#import "ASDataController.h" +#ifndef ASDataControllerSubclasses_Included +#define ASDataControllerSubclasses_Included + +//#import "ASDataController.h" @interface ASDataController (Subclasses) @@ -157,3 +160,5 @@ - (void)willMoveSection:(NSInteger)section toSection:(NSInteger)newSection; @end + +#endif diff --git a/AsyncDisplayKit/Details/ASDataController.h b/AsyncDisplayKit/Details/ASDataController.h index 78478924..5710b22b 100644 --- a/AsyncDisplayKit/Details/ASDataController.h +++ b/AsyncDisplayKit/Details/ASDataController.h @@ -6,17 +6,21 @@ * of patent rights can be found in the PATENTS file in the same directory. */ +#ifndef ASDataController_Included +#define ASDataController_Included + #import #import #import -#import "ASFlowLayoutController.h" +#import + +NS_ASSUME_NONNULL_BEGIN @class ASCellNode; @class ASDataController; -FOUNDATION_EXPORT NSString * const ASDataControllerRowNodeKind; - typedef NSUInteger ASDataControllerAnimationOptions; +FOUNDATION_EXPORT NSString * const ASDataControllerRowNodeKind; /** Data source for data controller @@ -68,22 +72,22 @@ typedef NSUInteger ASDataControllerAnimationOptions; Called for batch update. */ - (void)dataControllerBeginUpdates:(ASDataController *)dataController; -- (void)dataController:(ASDataController *)dataController endUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL))completion; +- (void)dataController:(ASDataController *)dataController endUpdatesAnimated:(BOOL)animated completion:(void (^ _Nullable)(BOOL))completion; /** Called for insertion of elements. */ -- (void)dataController:(ASDataController *)dataController didInsertNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; +- (void)dataController:(ASDataController *)dataController didInsertNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; /** Called for deletion of elements. */ -- (void)dataController:(ASDataController *)dataController didDeleteNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; +- (void)dataController:(ASDataController *)dataController didDeleteNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; /** Called for insertion of sections. */ -- (void)dataController:(ASDataController *)dataController didInsertSections:(NSArray *)sections atIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; +- (void)dataController:(ASDataController *)dataController didInsertSections:(NSArray *> *)sections atIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; /** Called for deletion of sections. @@ -140,7 +144,7 @@ typedef NSUInteger ASDataControllerAnimationOptions; - (void)endUpdates; -- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL))completion; +- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^ _Nullable)(BOOL))completion; - (void)insertSections:(NSIndexSet *)sections withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; @@ -150,11 +154,11 @@ typedef NSUInteger ASDataControllerAnimationOptions; - (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; -- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; +- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; -- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; +- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; -- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; +- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; /** * Re-measures all loaded nodes in the backing store. @@ -166,7 +170,7 @@ typedef NSUInteger ASDataControllerAnimationOptions; - (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; -- (void)reloadDataWithAnimationOptions:(ASDataControllerAnimationOptions)animationOptions completion:(void (^)())completion; +- (void)reloadDataWithAnimationOptions:(ASDataControllerAnimationOptions)animationOptions completion:(void (^ _Nullable)())completion; - (void)reloadDataImmediatelyWithAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; @@ -176,15 +180,19 @@ typedef NSUInteger ASDataControllerAnimationOptions; - (NSUInteger)numberOfRowsInSection:(NSUInteger)section; -- (ASCellNode *)nodeAtIndexPath:(NSIndexPath *)indexPath; +- (nullable ASCellNode *)nodeAtIndexPath:(NSIndexPath *)indexPath; -- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode; +- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode; -- (NSArray *)nodesAtIndexPaths:(NSArray *)indexPaths; +- (NSArray *)nodesAtIndexPaths:(NSArray *)indexPaths; /** * Direct access to the nodes that have completed calculation and layout */ -- (NSArray *)completedNodes; +- (NSArray *> *)completedNodes; @end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/AsyncDisplayKit/Details/ASDealloc2MainObject.h b/AsyncDisplayKit/Details/ASDealloc2MainObject.h index 06c298a5..88c08ba9 100644 --- a/AsyncDisplayKit/Details/ASDealloc2MainObject.h +++ b/AsyncDisplayKit/Details/ASDealloc2MainObject.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN /** * _OBJC_SUPPORTED_INLINE_REFCNT_WITH_DEALLOC2MAIN permits classes to implement their own reference counting and enforce @@ -19,3 +20,5 @@ - (BOOL)_isDeallocating; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASFlowLayoutController.h b/AsyncDisplayKit/Details/ASFlowLayoutController.h index 9b61a37b..a0845ed2 100644 --- a/AsyncDisplayKit/Details/ASFlowLayoutController.h +++ b/AsyncDisplayKit/Details/ASFlowLayoutController.h @@ -9,6 +9,9 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + +@class ASCellNode; typedef NS_ENUM(NSUInteger, ASFlowLayoutDirection) { ASFlowLayoutDirectionVertical, @@ -17,7 +20,7 @@ typedef NS_ENUM(NSUInteger, ASFlowLayoutDirection) { @protocol ASFlowLayoutControllerDataSource -- (NSArray *)completedNodes; // This provides access to ASDataController's _completedNodes multidimensional array. +- (NSArray *> *)completedNodes; // This provides access to ASDataController's _completedNodes multidimensional array. @end @@ -33,3 +36,5 @@ typedef NS_ENUM(NSUInteger, ASFlowLayoutDirection) { - (instancetype)initWithScrollOption:(ASFlowLayoutDirection)layoutDirection; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASHighlightOverlayLayer.h b/AsyncDisplayKit/Details/ASHighlightOverlayLayer.h index 6b7c236f..736ff087 100644 --- a/AsyncDisplayKit/Details/ASHighlightOverlayLayer.h +++ b/AsyncDisplayKit/Details/ASHighlightOverlayLayer.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN @interface ASHighlightOverlayLayer : CALayer @@ -19,16 +20,16 @@ @param rects Array containing CGRects wrapped in NSValue. @param targetLayer The layer that the rects are relative to. The rects will be translated to the receiver's coordinate space when rendering. */ -- (id)initWithRects:(NSArray *)rects targetLayer:(id)targetLayer; +- (id)initWithRects:(NSArray *)rects targetLayer:(nullable CALayer *)targetLayer; /** @summary Initializes with CGRects for the highlighting, in the receiver's coordinate space. @param rects Array containing CGRects wrapped in NSValue. */ -- (id)initWithRects:(NSArray *)rects; +- (id)initWithRects:(NSArray *)rects; -@property (atomic, strong) __attribute__((NSObject)) CGColorRef highlightColor; +@property (nullable, atomic, strong) __attribute__((NSObject)) CGColorRef highlightColor; @property (atomic, weak) CALayer *targetLayer; @end @@ -42,3 +43,5 @@ @property (nonatomic, assign, setter=as_setAllowsHighlightDrawing:) BOOL as_allowsHighlightDrawing; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASImageProtocols.h b/AsyncDisplayKit/Details/ASImageProtocols.h index 38465a2d..ba04eaaa 100644 --- a/AsyncDisplayKit/Details/ASImageProtocols.h +++ b/AsyncDisplayKit/Details/ASImageProtocols.h @@ -9,6 +9,7 @@ #import #import +NS_ASSUME_NONNULL_BEGIN @protocol ASImageCacheProtocol @@ -23,9 +24,9 @@ @discussion If `URL` is nil, `completion` will be invoked immediately with a nil image. This method should not block the calling thread as it is likely to be called from the main thread. */ -- (void)fetchCachedImageWithURL:(NSURL *)URL - callbackQueue:(dispatch_queue_t)callbackQueue - completion:(void (^)(CGImageRef imageFromCache))completion; +- (void)fetchCachedImageWithURL:(nullable NSURL *)URL + callbackQueue:(nullable dispatch_queue_t)callbackQueue + completion:(void (^)(CGImageRef _Nullable imageFromCache))completion; @end @@ -42,16 +43,14 @@ @param completion The block to be invoked when the download has completed, or has failed. @param image The image that was downloaded, if the image could be successfully downloaded; nil otherwise. @param error An error describing why the download of `URL` failed, if the download failed; nil otherwise. - @discussion If `URL` is nil, `completion` will be invoked immediately with a nil image and an error describing why the - download failed. This method is likely to be called on the main thread, so any custom implementations should make - sure to background any expensive download operations. + @discussion This method is likely to be called on the main thread, so any custom implementations should make sure to background any expensive download operations. @result An opaque identifier to be used in canceling the download, via `cancelImageDownloadForIdentifier:`. You must retain the identifier if you wish to use it later. */ -- (id)downloadImageWithURL:(NSURL *)URL - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgressBlock:(void (^)(CGFloat progress))downloadProgressBlock - completion:(void (^)(CGImageRef image, NSError *error))completion; +- (nullable id)downloadImageWithURL:(NSURL *)URL + callbackQueue:(nullable dispatch_queue_t)callbackQueue + downloadProgressBlock:(void (^ _Nullable)(CGFloat progress))downloadProgressBlock + completion:(void (^ _Nullable)(CGImageRef _Nullable image, NSError * _Nullable error))completion; /** @abstract Cancels an image download. @@ -59,6 +58,8 @@ `downloadImageWithURL:callbackQueue:downloadProgressBlock:completion:`. @discussion This method has no effect if `downloadIdentifier` is nil. */ -- (void)cancelImageDownloadForIdentifier:(id)downloadIdentifier; +- (void)cancelImageDownloadForIdentifier:(nullable id)downloadIdentifier; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASIndexPath.h b/AsyncDisplayKit/Details/ASIndexPath.h index a6eb514a..fde2b240 100644 --- a/AsyncDisplayKit/Details/ASIndexPath.h +++ b/AsyncDisplayKit/Details/ASIndexPath.h @@ -19,8 +19,11 @@ typedef struct { ASIndexPath end; } ASIndexPathRange; +NS_ASSUME_NONNULL_BEGIN + ASDISPLAYNODE_EXTERN_C_BEGIN + extern ASIndexPath ASIndexPathMake(NSInteger section, NSInteger row); extern BOOL ASIndexPathEqualToIndexPath(ASIndexPath first, ASIndexPath second); @@ -41,3 +44,5 @@ ASDISPLAYNODE_EXTERN_C_END - (ASIndexPath)ASIndexPathValue; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASLayoutController.h b/AsyncDisplayKit/Details/ASLayoutController.h index 759cb0cc..22e4b12a 100644 --- a/AsyncDisplayKit/Details/ASLayoutController.h +++ b/AsyncDisplayKit/Details/ASLayoutController.h @@ -12,6 +12,10 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + +@class ASCellNode; + typedef struct { CGFloat leadingBufferScreenfuls; CGFloat trailingBufferScreenfuls; @@ -26,20 +30,22 @@ typedef struct { */ - (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType; -- (BOOL)shouldUpdateForVisibleIndexPaths:(NSArray *)indexPaths viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType; +- (BOOL)shouldUpdateForVisibleIndexPaths:(NSArray *)indexPaths viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType; - (NSSet *)indexPathsForScrolling:(ASScrollDirection)scrollDirection viewportSize:(CGSize)viewportSize rangeType:(ASLayoutRangeType)rangeType; @optional -- (void)insertNodesAtIndexPaths:(NSArray *)indexPaths withSizes:(NSArray *)nodeSizes; +- (void)insertNodesAtIndexPaths:(NSArray *)indexPaths withSizes:(NSArray *)nodeSizes; -- (void)deleteNodesAtIndexPaths:(NSArray *)indexPaths; +- (void)deleteNodesAtIndexPaths:(NSArray *)indexPaths; -- (void)insertSections:(NSArray *)sections atIndexSet:(NSIndexSet *)indexSet; +- (void)insertSections:(NSArray*> *)sections atIndexSet:(NSIndexSet *)indexSet; - (void)deleteSectionsAtIndexSet:(NSIndexSet *)indexSet; -- (void)setVisibleNodeIndexPaths:(NSArray *)indexPaths; +- (void)setVisibleNodeIndexPaths:(NSArray *)indexPaths; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASMutableAttributedStringBuilder.h b/AsyncDisplayKit/Details/ASMutableAttributedStringBuilder.h index 99d7c9ad..4df67ada 100644 --- a/AsyncDisplayKit/Details/ASMutableAttributedStringBuilder.h +++ b/AsyncDisplayKit/Details/ASMutableAttributedStringBuilder.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN /* * Use this class to compose new attributed strings. You may use the normal @@ -38,14 +39,14 @@ */ @interface ASMutableAttributedStringBuilder : NSMutableAttributedString -- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary *)attrs; +- (instancetype)initWithString:(NSString *)str attributes:(nullable NSDictionary *)attrs; - (instancetype)initWithAttributedString:(NSAttributedString *)attrStr; - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str; -- (void)setAttributes:(NSDictionary *)attrs range:(NSRange)range; +- (void)setAttributes:(nullable NSDictionary *)attrs range:(NSRange)range; - (void)addAttribute:(NSString *)name value:(id)value range:(NSRange)range; -- (void)addAttributes:(NSDictionary *)attrs range:(NSRange)range; +- (void)addAttributes:(NSDictionary *)attrs range:(NSRange)range; - (void)removeAttribute:(NSString *)name range:(NSRange)range; - (void)replaceCharactersInRange:(NSRange)range withAttributedString:(NSAttributedString *)attrString; @@ -57,3 +58,5 @@ - (NSMutableAttributedString *)composedAttributedString; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/Details/ASRangeController.h b/AsyncDisplayKit/Details/ASRangeController.h index c8a74e18..3e8e00a5 100644 --- a/AsyncDisplayKit/Details/ASRangeController.h +++ b/AsyncDisplayKit/Details/ASRangeController.h @@ -10,9 +10,10 @@ #import #import -#import #import +NS_ASSUME_NONNULL_BEGIN + @protocol ASRangeControllerDataSource; @protocol ASRangeControllerDelegate; @@ -78,7 +79,7 @@ * * @returns an array of index paths corresponding to the nodes currently visible onscreen (i.e., the visible range). */ -- (NSArray *)visibleNodeIndexPathsForRangeController:(ASRangeController *)rangeController; +- (NSArray *)visibleNodeIndexPathsForRangeController:(ASRangeController *)rangeController; /** * @param rangeController Sender. @@ -130,7 +131,7 @@ * * @param animationOptions Animation options. See ASDataControllerAnimationOptions. */ -- (void)rangeController:(ASRangeController *)rangeController didInsertNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; +- (void)rangeController:(ASRangeController *)rangeController didInsertNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; /** * Called for nodes deletion. @@ -143,7 +144,7 @@ * * @param animationOptions Animation options. See ASDataControllerAnimationOptions. */ -- (void)rangeController:(ASRangeController *)rangeController didDeleteNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; +- (void)rangeController:(ASRangeController *)rangeController didDeleteNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; /** * Called for section insertion. @@ -168,3 +169,5 @@ - (void)rangeController:(ASRangeController *)rangeController didDeleteSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/Details/ASRangeHandler.h b/AsyncDisplayKit/Details/ASRangeHandler.h index 22a7c564..136736f4 100644 --- a/AsyncDisplayKit/Details/ASRangeHandler.h +++ b/AsyncDisplayKit/Details/ASRangeHandler.h @@ -10,6 +10,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + @class ASDisplayNode; @protocol ASRangeHandler @@ -20,3 +22,5 @@ - (void)node:(ASDisplayNode *)node exitedRangeOfType:(ASLayoutRangeType)rangeType; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/Details/ASRangeHandlerPreload.h b/AsyncDisplayKit/Details/ASRangeHandlerPreload.h index 7dc01138..eb7c34f9 100644 --- a/AsyncDisplayKit/Details/ASRangeHandlerPreload.h +++ b/AsyncDisplayKit/Details/ASRangeHandlerPreload.h @@ -10,6 +10,10 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface ASRangeHandlerPreload : NSObject @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASRangeHandlerRender.h b/AsyncDisplayKit/Details/ASRangeHandlerRender.h index b064cb6a..8b00982b 100644 --- a/AsyncDisplayKit/Details/ASRangeHandlerRender.h +++ b/AsyncDisplayKit/Details/ASRangeHandlerRender.h @@ -10,6 +10,10 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface ASRangeHandlerRender : NSObject @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/ASScrollDirection.h b/AsyncDisplayKit/Details/ASScrollDirection.h index a46295cf..2d75703d 100644 --- a/AsyncDisplayKit/Details/ASScrollDirection.h +++ b/AsyncDisplayKit/Details/ASScrollDirection.h @@ -10,6 +10,8 @@ #import "ASBaseDefines.h" +NS_ASSUME_NONNULL_BEGIN + typedef NS_OPTIONS(NSInteger, ASScrollDirection) { ASScrollDirectionNone = 0, ASScrollDirectionRight = 1 << 0, @@ -32,3 +34,5 @@ BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection); BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection); ASDISPLAYNODE_EXTERN_C_END + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/CGRect+ASConvenience.h b/AsyncDisplayKit/Details/CGRect+ASConvenience.h index a9cc714a..a60b46be 100644 --- a/AsyncDisplayKit/Details/CGRect+ASConvenience.h +++ b/AsyncDisplayKit/Details/CGRect+ASConvenience.h @@ -6,13 +6,18 @@ * of patent rights can be found in the PATENTS file in the same directory. */ +#import #import #import "ASBaseDefines.h" +NS_ASSUME_NONNULL_BEGIN + ASDISPLAYNODE_EXTERN_C_BEGIN CGRect asdk_CGRectExpandHorizontally(CGRect rect, CGFloat negativeMultiplier, CGFloat positiveMultiplier); CGRect asdk_CGRectExpandVertically(CGRect rect, CGFloat negativeMultiplier, CGFloat positiveMultiplier); ASDISPLAYNODE_EXTERN_C_END + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Details/NSMutableAttributedString+TextKitAdditions.h b/AsyncDisplayKit/Details/NSMutableAttributedString+TextKitAdditions.h index 8810ba35..cd2dd1eb 100644 --- a/AsyncDisplayKit/Details/NSMutableAttributedString+TextKitAdditions.h +++ b/AsyncDisplayKit/Details/NSMutableAttributedString+TextKitAdditions.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN @interface NSMutableAttributedString (TextKitAdditions) @@ -20,3 +21,5 @@ - (void)attributeTextInRange:(NSRange)range withTextKitParagraphStyle:(NSParagraphStyle *)paragraphStyle; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/Details/UICollectionViewLayout+ASConvenience.h b/AsyncDisplayKit/Details/UICollectionViewLayout+ASConvenience.h index 1853be6f..4710cbdf 100644 --- a/AsyncDisplayKit/Details/UICollectionViewLayout+ASConvenience.h +++ b/AsyncDisplayKit/Details/UICollectionViewLayout+ASConvenience.h @@ -8,8 +8,12 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface UICollectionViewLayout (ASConvenience) - (BOOL)asdk_isFlowLayout; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/Details/UIView+ASConvenience.h b/AsyncDisplayKit/Details/UIView+ASConvenience.h index e4fa194a..d84f7992 100644 --- a/AsyncDisplayKit/Details/UIView+ASConvenience.h +++ b/AsyncDisplayKit/Details/UIView+ASConvenience.h @@ -8,6 +8,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + /** These are the properties we support from CALayer (implemented in the pending state) @@ -18,7 +20,7 @@ @property (nonatomic, assign) CGPoint position; @property (nonatomic, assign) CGFloat zPosition; @property (nonatomic, assign) CGPoint anchorPoint; -@property (nonatomic, retain) id contents; +@property (nullable, nonatomic, retain) id contents; @property (nonatomic, assign) CGFloat cornerRadius; @property (nonatomic, assign) CGFloat contentsScale; @property (nonatomic, assign) CATransform3D transform; @@ -45,15 +47,15 @@ */ @protocol ASDisplayNodeViewProperties -@property (nonatomic, assign) BOOL clipsToBounds; -@property (nonatomic, getter=isHidden) BOOL hidden; -@property (nonatomic, assign) BOOL autoresizesSubviews; -@property (nonatomic, assign) UIViewAutoresizing autoresizingMask; -@property (nonatomic, retain) UIColor *tintColor; -@property (nonatomic, assign) CGFloat alpha; -@property (nonatomic, assign) CGRect bounds; -@property (nonatomic, assign) CGRect frame; // Only for use with nodes wrapping synchronous views -@property (nonatomic, assign) UIViewContentMode contentMode; +@property (nonatomic, assign) BOOL clipsToBounds; +@property (nonatomic, getter=isHidden) BOOL hidden; +@property (nonatomic, assign) BOOL autoresizesSubviews; +@property (nonatomic, assign) UIViewAutoresizing autoresizingMask; +@property (nonatomic, retain, null_resettable) UIColor *tintColor; +@property (nonatomic, assign) CGFloat alpha; +@property (nonatomic, assign) CGRect bounds; +@property (nonatomic, assign) CGRect frame; // Only for use with nodes wrapping synchronous views +@property (nonatomic, assign) UIViewContentMode contentMode; @property (nonatomic, assign, getter=isUserInteractionEnabled) BOOL userInteractionEnabled; @property (nonatomic, assign, getter=isExclusiveTouch) BOOL exclusiveTouch; @property (nonatomic, assign, getter=asyncdisplaykit_isAsyncTransactionContainer, setter = asyncdisplaykit_setAsyncTransactionContainer:) BOOL asyncdisplaykit_asyncTransactionContainer; @@ -76,6 +78,8 @@ */ // Accessibility identification support -@property (nonatomic, copy) NSString *accessibilityIdentifier; +@property (nullable, nonatomic, copy) NSString *accessibilityIdentifier; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASAsciiArtBoxCreator.h b/AsyncDisplayKit/Layout/ASAsciiArtBoxCreator.h index 15d825a5..18a925a7 100644 --- a/AsyncDisplayKit/Layout/ASAsciiArtBoxCreator.h +++ b/AsyncDisplayKit/Layout/ASAsciiArtBoxCreator.h @@ -10,6 +10,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + @protocol ASLayoutableAsciiArtProtocol /** * Returns an ascii-art representation of this object and its children. @@ -41,7 +43,7 @@ * | ASTextNode ASTextNode ASTextNode | * ---------------------------------------- */ -+ (NSString *)horizontalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent; ++ (NSString *)horizontalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent; /** * Renders an ascii art box with the children aligned vertically. @@ -52,8 +54,8 @@ * | ASTextNode | * --------------------- */ -+ (NSString *)verticalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent; ++ (NSString *)verticalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent; @end - +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h b/AsyncDisplayKit/Layout/ASBackgroundLayoutSpec.h index cab51ea8..9f04490c 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 37ba24e7..f8413d27 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 590f9486..c96b2155 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 ab0a6f10..aa320e94 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 71892b59..4619269d 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 7b9800ff..88036d1b 100644 --- a/AsyncDisplayKit/Layout/ASLayoutOptions.h +++ b/AsyncDisplayKit/Layout/ASLayoutOptions.h @@ -9,7 +9,10 @@ */ #import -#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN @protocol ASLayoutable; @@ -52,7 +55,7 @@ * * @return a new instance of ASLayoutOptions */ -- (instancetype)initWithLayoutable:(id)layoutable; +- (instancetype)initWithLayoutable:(nullable 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 +86,6 @@ @property (nonatomic, readwrite) CGPoint layoutPosition; @end + +NS_ASSUME_NONNULL_END + diff --git a/AsyncDisplayKit/Layout/ASLayoutSpec.h b/AsyncDisplayKit/Layout/ASLayoutSpec.h index 6426317b..da6de78e 100644 --- a/AsyncDisplayKit/Layout/ASLayoutSpec.h +++ b/AsyncDisplayKit/Layout/ASLayoutSpec.h @@ -11,6 +11,8 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + /** A layout spec is an immutable object that describes a layout, loosely inspired by React. */ @interface ASLayoutSpec : NSObject @@ -70,7 +72,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 @@ -84,17 +86,18 @@ */ /** 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 @interface ASLayoutSpec (Debugging) @@ -105,3 +108,6 @@ + (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName; @end + +NS_ASSUME_NONNULL_END + diff --git a/AsyncDisplayKit/Layout/ASLayoutSpec.mm b/AsyncDisplayKit/Layout/ASLayoutSpec.mm index 376c606e..dfe40084 100644 --- a/AsyncDisplayKit/Layout/ASLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASLayoutSpec.mm @@ -8,7 +8,7 @@ * */ -#import "ASLayoutSpec.h" +#import "ASLayoutOptionsPrivate.h" #import "ASAssert.h" #import "ASBaseDefines.h" @@ -16,7 +16,6 @@ #import "ASInternalHelpers.h" #import "ASLayout.h" #import "ASLayoutOptions.h" -#import "ASLayoutOptionsPrivate.h" #import "ASThread.h" #import diff --git a/AsyncDisplayKit/Layout/ASLayoutable.h b/AsyncDisplayKit/Layout/ASLayoutable.h index 7e0e950d..4653e38d 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 05e53d92..6e1c321b 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 2affa56a..f9109829 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 9522d43d..db5d662a 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 a2afc296..24881600 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. @@ -70,7 +71,7 @@ @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; /** * @return A stack layout spec with direction of ASStackLayoutDirectionVertical @@ -83,3 +84,5 @@ + (instancetype)horizontalStackLayoutSpec; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/Layout/ASStackLayoutSpec.mm b/AsyncDisplayKit/Layout/ASStackLayoutSpec.mm index facbbb1e..76539bf5 100644 --- a/AsyncDisplayKit/Layout/ASStackLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASStackLayoutSpec.mm @@ -8,8 +8,6 @@ * */ -#import "ASStackLayoutSpec.h" - #import #import @@ -19,7 +17,6 @@ #import "ASLayoutSpecUtilities.h" #import "ASStackBaselinePositionedLayout.h" #import "ASStackLayoutSpecUtilities.h" -#import "ASStackPositionedLayout.h" #import "ASStackUnpositionedLayout.h" #import "ASThread.h" diff --git a/AsyncDisplayKit/Layout/ASStackLayoutable.h b/AsyncDisplayKit/Layout/ASStackLayoutable.h index 3ebc9304..9044a275 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 8bd3f3d9..44da4adf 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/ASStaticLayoutSpec.mm b/AsyncDisplayKit/Layout/ASStaticLayoutSpec.mm index ae957559..2d0edba4 100644 --- a/AsyncDisplayKit/Layout/ASStaticLayoutSpec.mm +++ b/AsyncDisplayKit/Layout/ASStaticLayoutSpec.mm @@ -14,7 +14,6 @@ #import "ASLayoutOptions.h" #import "ASInternalHelpers.h" #import "ASLayout.h" -#import "ASStaticLayoutable.h" @implementation ASStaticLayoutSpec diff --git a/AsyncDisplayKit/Layout/ASStaticLayoutable.h b/AsyncDisplayKit/Layout/ASStaticLayoutable.h index e0325cfc..8e5f6e62 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 diff --git a/AsyncDisplayKit/Private/ASBasicImageDownloaderInternal.h b/AsyncDisplayKit/Private/ASBasicImageDownloaderInternal.h index b6751a5d..210fe397 100644 --- a/AsyncDisplayKit/Private/ASBasicImageDownloaderInternal.h +++ b/AsyncDisplayKit/Private/ASBasicImageDownloaderInternal.h @@ -6,9 +6,6 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#import "ASThread.h" - - @interface ASBasicImageDownloaderContext : NSObject + (ASBasicImageDownloaderContext *)contextForURL:(NSURL *)URL; diff --git a/AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm b/AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm index b0cabb67..2566d0e2 100644 --- a/AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm +++ b/AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm @@ -8,10 +8,14 @@ #import "_ASCoreAnimationExtras.h" #import "_ASAsyncTransaction.h" +#import "_ASDisplayLayer.h" #import "ASAssert.h" #import "ASDisplayNodeInternal.h" #import "ASDisplayNode+FrameworkPrivate.h" +@interface ASDisplayNode () <_ASDisplayLayerDelegate> +@end + @implementation ASDisplayNode (AsyncDisplay) /** diff --git a/AsyncDisplayKit/Private/ASDisplayNode+FrameworkPrivate.h b/AsyncDisplayKit/Private/ASDisplayNode+FrameworkPrivate.h index 978032d9..0c016d00 100644 --- a/AsyncDisplayKit/Private/ASDisplayNode+FrameworkPrivate.h +++ b/AsyncDisplayKit/Private/ASDisplayNode+FrameworkPrivate.h @@ -11,7 +11,6 @@ // These methods must never be called or overridden by other classes. // -#import "_ASDisplayLayer.h" #import "_AS-objc-internal.h" #import "ASDisplayNodeExtraIvars.h" #import "ASDisplayNode.h" @@ -19,6 +18,8 @@ #import "ASThread.h" #import "ASLayoutOptions.h" +NS_ASSUME_NONNULL_BEGIN + // Project-wide control for whether the offscreen UIWindow is used for display, or if // ASDK's internal system for coalescing and triggering display events is used. #define USE_WORKING_WINDOW 1 @@ -50,7 +51,7 @@ typedef NS_OPTIONS(NSUInteger, ASHierarchyState) ASHierarchyStateTransitioningSupernodes = 1 << 2 }; -@interface ASDisplayNode () <_ASDisplayLayerDelegate> +@interface ASDisplayNode () { @protected ASInterfaceState _interfaceState; @@ -111,9 +112,11 @@ typedef NS_OPTIONS(NSUInteger, ASHierarchyState) @end @interface UIView (ASDisplayNodeInternal) -@property (nonatomic, assign, readwrite) ASDisplayNode *asyncdisplaykit_node; +@property (nullable, nonatomic, assign, readwrite) ASDisplayNode *asyncdisplaykit_node; @end @interface CALayer (ASDisplayNodeInternal) -@property (nonatomic, assign, readwrite) ASDisplayNode *asyncdisplaykit_node; +@property (nullable, nonatomic, assign, readwrite) ASDisplayNode *asyncdisplaykit_node; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/Private/ASDisplayNodeInternal.h b/AsyncDisplayKit/Private/ASDisplayNodeInternal.h index c4c9d2ab..ca5a7ee1 100644 --- a/AsyncDisplayKit/Private/ASDisplayNodeInternal.h +++ b/AsyncDisplayKit/Private/ASDisplayNodeInternal.h @@ -11,7 +11,6 @@ // These methods must never be called or overridden by other classes. // -#import "_ASDisplayLayer.h" #import "_AS-objc-internal.h" #import "ASDisplayNodeExtraIvars.h" #import "ASDisplayNode.h" @@ -19,6 +18,9 @@ #import "ASThread.h" #import "ASLayoutOptions.h" +@protocol _ASDisplayLayerDelegate; +@class _ASDisplayLayer; + BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector); void ASDisplayNodeRespectThreadAffinityOfNode(ASDisplayNode *node, void (^block)()); @@ -39,7 +41,7 @@ typedef NS_OPTIONS(NSUInteger, ASDisplayNodeMethodOverrides) #define TIME_DISPLAYNODE_OPS (DEBUG || PROFILE) -@interface ASDisplayNode () <_ASDisplayLayerDelegate> +@interface ASDisplayNode () { @protected // Protects access to _view, _layer, _pendingViewState, _subnodes, _supernode, and other properties which are accessed from multiple threads. diff --git a/AsyncDisplayKit/Private/ASStackPositionedLayout.h b/AsyncDisplayKit/Private/ASStackPositionedLayout.h index 211bda5b..2ff9e526 100644 --- a/AsyncDisplayKit/Private/ASStackPositionedLayout.h +++ b/AsyncDisplayKit/Private/ASStackPositionedLayout.h @@ -10,7 +10,6 @@ #import "ASLayout.h" #import "ASDimension.h" -#import "ASStackLayoutSpec.h" #import "ASStackUnpositionedLayout.h" /** Represents a set of laid out and positioned stack layout children. */ diff --git a/AsyncDisplayKit/Private/_ASHierarchyChangeSet.h b/AsyncDisplayKit/Private/_ASHierarchyChangeSet.h index b1f39cbf..a2547ff0 100644 --- a/AsyncDisplayKit/Private/_ASHierarchyChangeSet.h +++ b/AsyncDisplayKit/Private/_ASHierarchyChangeSet.h @@ -7,7 +7,9 @@ // #import -#import "ASDataController.h" +#import + +typedef NSUInteger ASDataControllerAnimationOptions; typedef NS_ENUM(NSInteger, _ASHierarchyChangeType) { _ASHierarchyChangeTypeReload, diff --git a/AsyncDisplayKit/TextKit/ASTextKitCoreTextAdditions.h b/AsyncDisplayKit/TextKit/ASTextKitCoreTextAdditions.h index 10f0cf40..9b8ad1ae 100644 --- a/AsyncDisplayKit/TextKit/ASTextKitCoreTextAdditions.h +++ b/AsyncDisplayKit/TextKit/ASTextKitCoreTextAdditions.h @@ -11,6 +11,7 @@ #import +NS_ASSUME_NONNULL_BEGIN ASDISPLAYNODE_EXTERN_C_BEGIN /** @@ -81,3 +82,5 @@ ASDISPLAYNODE_EXTERN_C_END + (instancetype)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/TextKit/ASTextKitHelpers.h b/AsyncDisplayKit/TextKit/ASTextKitHelpers.h index e4163173..12ec1047 100644 --- a/AsyncDisplayKit/TextKit/ASTextKitHelpers.h +++ b/AsyncDisplayKit/TextKit/ASTextKitHelpers.h @@ -12,6 +12,8 @@ #import #import "ASBaseDefines.h" +NS_ASSUME_NONNULL_BEGIN + ASDISPLAYNODE_INLINE CGFloat ceilPixelValueForScale(CGFloat f, CGFloat scale) { // Round up to device pixel (.5 on retina) @@ -35,7 +37,7 @@ ASDISPLAYNODE_INLINE CGSize ceilSizeValue(CGSize s) @return An `ASTextKitComponents` containing the created components. The text view component will be nil. @discussion The returned components will be hooked up together, so they are ready for use as a system upon return. */ -+ (ASTextKitComponents *)componentsWithAttributedSeedString:(NSAttributedString *)attributedSeedString ++ (ASTextKitComponents *)componentsWithAttributedSeedString:(nullable NSAttributedString *)attributedSeedString textContainerSize:(CGSize)textContainerSize; /** @@ -49,6 +51,8 @@ ASDISPLAYNODE_INLINE CGSize ceilSizeValue(CGSize s) @property (nonatomic, strong, readonly) NSTextStorage *textStorage; @property (nonatomic, strong, readonly) NSTextContainer *textContainer; @property (nonatomic, strong, readonly) NSLayoutManager *layoutManager; -@property (nonatomic, strong) UITextView *textView; +@property (nullable, nonatomic, strong) UITextView *textView; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/TextKit/ASTextNodeWordKerner.h b/AsyncDisplayKit/TextKit/ASTextNodeWordKerner.h index 1be6390c..a98654cf 100644 --- a/AsyncDisplayKit/TextKit/ASTextNodeWordKerner.h +++ b/AsyncDisplayKit/TextKit/ASTextNodeWordKerner.h @@ -9,6 +9,7 @@ #import #import +NS_ASSUME_NONNULL_BEGIN /** @abstract This class acts as the NSLayoutManagerDelegate for ASTextNode. @@ -28,3 +29,5 @@ */ @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKitTests/ASDisplayNodeTests.m b/AsyncDisplayKitTests/ASDisplayNodeTests.m index ae7c4acf..4c45aead 100644 --- a/AsyncDisplayKitTests/ASDisplayNodeTests.m +++ b/AsyncDisplayKitTests/ASDisplayNodeTests.m @@ -1071,7 +1071,8 @@ static inline BOOL _CGPointEqualToPointWithEpsilon(CGPoint point1, CGPoint point - (void)testSubnodes { ASDisplayNode *parent = [[ASDisplayNode alloc] init]; - XCTAssertNoThrow([parent addSubnode:nil], @"Don't try to add nil, but we'll deal."); + ASDisplayNode *nilNode = nil; + XCTAssertNoThrow([parent addSubnode:nilNode], @"Don't try to add nil, but we'll deal."); XCTAssertNoThrow([parent addSubnode:parent], @"Not good, test that we recover"); XCTAssertEqual(0u, parent.subnodes.count, @"We shouldn't have any subnodes"); } @@ -1489,13 +1490,14 @@ static inline BOOL _CGPointEqualToPointWithEpsilon(CGPoint point1, CGPoint point XCTAssertNodesHaveParent(parent, a, b, c); // Check insertSubnode with no below - XCTAssertThrows([parent insertSubnode:b belowSubnode:nil], @"Can't insert below a nil"); + ASDisplayNode *nilNode = nil; + XCTAssertThrows([parent insertSubnode:b belowSubnode:nilNode], @"Can't insert below a nil"); // Check nothing was inserted XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"c,a,b", @"Incorrect insertion below"); - XCTAssertThrows([parent insertSubnode:nil belowSubnode:nil], @"Can't insert a nil subnode"); - XCTAssertThrows([parent insertSubnode:nil belowSubnode:a], @"Can't insert a nil subnode"); + XCTAssertThrows([parent insertSubnode:nilNode belowSubnode:nilNode], @"Can't insert a nil subnode"); + XCTAssertThrows([parent insertSubnode:nilNode belowSubnode:a], @"Can't insert a nil subnode"); // Check inserting below when you're already in the array // (c,a,b) => (a,c,b) @@ -1569,13 +1571,14 @@ static inline BOOL _CGPointEqualToPointWithEpsilon(CGPoint point1, CGPoint point // Check insertSubnode with invalid parameters throws and doesn't change anything // (a,c,b) => (a,c,b) - XCTAssertThrows([parent insertSubnode:b aboveSubnode:nil], @"Can't insert below a nil"); + ASDisplayNode *nilNode = nil; + XCTAssertThrows([parent insertSubnode:b aboveSubnode:nilNode], @"Can't insert below a nil"); XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business"); - XCTAssertThrows([parent insertSubnode:nil aboveSubnode:nil], @"Can't insert a nil subnode"); + XCTAssertThrows([parent insertSubnode:nilNode aboveSubnode:nilNode], @"Can't insert a nil subnode"); XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business"); - XCTAssertThrows([parent insertSubnode:nil aboveSubnode:a], @"Can't insert a nil subnode"); + XCTAssertThrows([parent insertSubnode:nilNode aboveSubnode:a], @"Can't insert a nil subnode"); XCTAssertNodeSubnodeSubviewSublayerOrder(parent, loaded, isLayerBacked, @"a,c,b", @"Check no monkey business"); // Check inserting above when you're already in the array diff --git a/AsyncDisplayKitTests/ASLayoutSpecSnapshotTestsHelper.m b/AsyncDisplayKitTests/ASLayoutSpecSnapshotTestsHelper.m index 4cd9232f..92895d5a 100644 --- a/AsyncDisplayKitTests/ASLayoutSpecSnapshotTestsHelper.m +++ b/AsyncDisplayKitTests/ASLayoutSpecSnapshotTestsHelper.m @@ -57,7 +57,7 @@ layout.position = CGPointZero; layout = [ASLayout layoutWithLayoutableObject:self size:layout.size sublayouts:@[layout]]; _layoutUnderTest = [layout flattenedLayoutUsingPredicateBlock:^BOOL(ASLayout *evaluatedLayout) { - return [self.subnodes containsObject:evaluatedLayout.layoutableObject]; + return [self.subnodes containsObject:(ASDisplayNode *)evaluatedLayout.layoutableObject]; }]; self.frame = CGRectMake(0, 0, _layoutUnderTest.size.width, _layoutUnderTest.size.height); [self measure:_layoutUnderTest.size]; diff --git a/AsyncDisplayKitTests/ASMultiplexImageNodeTests.m b/AsyncDisplayKitTests/ASMultiplexImageNodeTests.m index a08173d5..069b545d 100644 --- a/AsyncDisplayKitTests/ASMultiplexImageNodeTests.m +++ b/AsyncDisplayKitTests/ASMultiplexImageNodeTests.m @@ -278,7 +278,7 @@ static BOOL ASRunRunLoopUntilBlockIsTrue(BOOL (^block)()) return; // Bail if it's trying to load an identifier that's more than one step than what's loaded. - NSInteger nextImageIdentifier = [imageNode.loadedImageIdentifier integerValue] + 1; + NSInteger nextImageIdentifier = [(NSNumber *)imageNode.loadedImageIdentifier integerValue] + 1; if (requestedIdentifierValue != nextImageIdentifier) return; @@ -344,7 +344,7 @@ static BOOL ASRunRunLoopUntilBlockIsTrue(BOOL (^block)()) // Wait until the image is loaded. ASRunRunLoopUntilBlockIsTrue(^BOOL{ - return [imageNode.loadedImageIdentifier isEqual:imageIdentifier]; + return [(id)imageNode.loadedImageIdentifier isEqual:imageIdentifier]; }); // Verify the delegation. diff --git a/build.sh b/build.sh index 935a0a9b..d2f19504 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,8 @@ #!/bin/bash # **** Update me when new Xcode versions are released! **** -PLATFORM="platform=iOS Simulator,OS=9.0,name=iPhone 6" -SDK="iphonesimulator9.0" +PLATFORM="platform=iOS Simulator,OS=9.2,name=iPhone 6" +SDK="iphonesimulator9.2" # It is pitch black. diff --git a/examples/Kittens/Sample.xcodeproj/project.pbxproj b/examples/Kittens/Sample.xcodeproj/project.pbxproj index ddfd8840..becf2611 100644 --- a/examples/Kittens/Sample.xcodeproj/project.pbxproj +++ b/examples/Kittens/Sample.xcodeproj/project.pbxproj @@ -128,6 +128,7 @@ 05E2127E19D4DB510098F589 /* Frameworks */, 05E2127F19D4DB510098F589 /* Resources */, F012A6F39E0149F18F564F50 /* Copy Pods Resources */, + 54296444B3B4D82560F3906E /* Embed Pods Frameworks */, ); buildRules = ( ); @@ -184,6 +185,21 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 54296444B3B4D82560F3906E /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; E080B80F89C34A25B3488E26 /* Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/examples/Swift/Sample.xcodeproj/project.pbxproj b/examples/Swift/Sample.xcodeproj/project.pbxproj index 10ad4f73..6675b3b3 100644 --- a/examples/Swift/Sample.xcodeproj/project.pbxproj +++ b/examples/Swift/Sample.xcodeproj/project.pbxproj @@ -129,6 +129,7 @@ 050E7C6619D22E19004363C2 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0600; ORGANIZATIONNAME = Facebook;