diff --git a/AsyncDisplayKit/ASCellNode.h b/AsyncDisplayKit/ASCellNode.h index 12cc6302f4..380eddbe01 100644 --- a/AsyncDisplayKit/ASCellNode.h +++ b/AsyncDisplayKit/ASCellNode.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN /** * Generic cell node. Subclass ASCellNode instead of to use . @@ -43,3 +44,5 @@ @property (nonatomic, copy) NSString *text; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/ASCollectionNode.h b/AsyncDisplayKit/ASCollectionNode.h index c0489b2297..463014024d 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. @@ -19,3 +21,5 @@ @property (nonatomic, readonly) ASCollectionView *view; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/ASCollectionNode.m b/AsyncDisplayKit/ASCollectionNode.m index 2a131bfecd..2933289792 100644 --- a/AsyncDisplayKit/ASCollectionNode.m +++ b/AsyncDisplayKit/ASCollectionNode.m @@ -13,7 +13,7 @@ - (instancetype)init { ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER(); - self = [self initWithCollectionViewLayout:nil]; // Will throw an exception for lacking a UICV Layout. + self = [self initWithCollectionViewLayout:[UICollectionViewFlowLayout new]]; return nil; } diff --git a/AsyncDisplayKit/ASCollectionView.h b/AsyncDisplayKit/ASCollectionView.h index 4756835551..70264fc477 100644 --- a/AsyncDisplayKit/ASCollectionView.h +++ b/AsyncDisplayKit/ASCollectionView.h @@ -18,6 +18,7 @@ @protocol ASCollectionViewDataSource; @protocol ASCollectionViewDelegate; +NS_ASSUME_NONNULL_BEGIN /** * Node-based collection view. @@ -90,7 +91,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. @@ -101,7 +102,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. @@ -110,7 +111,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. @@ -169,7 +170,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. @@ -179,7 +180,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. @@ -189,7 +190,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. @@ -217,7 +218,7 @@ * * @returns an array containing the nodes being displayed on screen. */ -- (NSArray *)visibleNodes; +- (NSArray *)visibleNodes; /** * Query the sized node at `indexPath` for its calculatedSize. @@ -303,7 +304,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 @@ -353,3 +354,5 @@ @property (nonatomic, assign) ASRangeTuningParameters rangeTuningParameters ASDISPLAYNODE_DEPRECATED; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASControlNode+Subclasses.h b/AsyncDisplayKit/ASControlNode+Subclasses.h index 062f21545a..90c5f68e46 100644 --- a/AsyncDisplayKit/ASControlNode+Subclasses.h +++ b/AsyncDisplayKit/ASControlNode+Subclasses.h @@ -8,6 +8,7 @@ #import +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 \ No newline at end of file diff --git a/AsyncDisplayKit/ASControlNode.h b/AsyncDisplayKit/ASControlNode.h index d08a09c69a..28a40ad51e 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 44b81ac1b1..5814376d5b 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. @@ -85,7 +87,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 */ @@ -208,7 +210,7 @@ * * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) */ -+ (UIImage *)displayWithParameters:(id)parameters ++ (nullable UIImage *)displayWithParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock; /** @@ -305,7 +307,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. @@ -313,7 +315,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. @@ -321,7 +323,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. @@ -329,7 +331,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:(NSSet *)touches withEvent:(nullable UIEvent *)event; /** @name Managing Gesture Recognizers */ @@ -359,7 +361,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; +- (UIView *)hitTest:(CGPoint)point withEvent:(nullable UIEvent *)event; /** @name Observing node-related changes */ @@ -410,7 +412,7 @@ * * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) */ -- (UIImage *)placeholderImage; +- (nullable UIImage *)placeholderImage; /** @name Description */ @@ -428,8 +430,10 @@ @interface ASDisplayNode (ASDisplayNodePrivate) // This method has proven helpful in a few rare scenarios, similar to a category extension on UIView, // but it's considered private API for now and its use should not be encouraged. -- (ASDisplayNode *)_supernodeWithClass:(Class)supernodeClass; +- (nullable ASDisplayNode *)_supernodeWithClass:(Class)supernodeClass; @end #define ASDisplayNodeAssertThreadAffinity(viewNode) ASDisplayNodeAssert(!viewNode || ASDisplayNodeThreadIsMain() || !(viewNode).nodeLoaded, @"Incorrect display node thread affinity") #define ASDisplayNodeCAssertThreadAffinity(viewNode) ASDisplayNodeCAssert(!viewNode || ASDisplayNodeThreadIsMain() || !(viewNode).nodeLoaded, @"Incorrect display node thread affinity") + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASDisplayNode.h b/AsyncDisplayKit/ASDisplayNode.h index 11a138ea4f..0cfdae9331 100644 --- a/AsyncDisplayKit/ASDisplayNode.h +++ b/AsyncDisplayKit/ASDisplayNode.h @@ -15,17 +15,19 @@ #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)(); /** * 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. @@ -60,7 +62,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * @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; /** @@ -71,7 +73,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * @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. @@ -82,7 +84,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * @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. @@ -92,7 +94,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * @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. @@ -103,7 +105,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * @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 */ @@ -295,7 +297,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); /** * @abstract The receiver's immediate subnodes. */ -@property (nonatomic, readonly, retain) NSArray *subnodes; +@property (nonatomic, readonly, retain) NSArray *subnodes; /** * @abstract The receiver's supernode. @@ -454,7 +456,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * * @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 */ @@ -468,7 +470,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * * @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; /** @@ -479,7 +481,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * * @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; /** @@ -490,7 +492,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * * @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. @@ -500,7 +502,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * * @return The converted rectangle. */ -- (CGRect)convertRect:(CGRect)rect fromNode:(ASDisplayNode *)node; +- (CGRect)convertRect:(CGRect)rect fromNode:(nullable ASDisplayNode *)node; /** @name UIResponder methods */ @@ -510,7 +512,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); - (BOOL)canResignFirstResponder; // default==YES - (BOOL)resignFirstResponder; // default==NO (no-op) - (BOOL)isFirstResponder; -- (BOOL)canPerformAction:(SEL)action withSender:(id)sender; +- (BOOL)canPerformAction:(SEL)action withSender:(nullable id)sender; @end @@ -583,7 +585,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); @property (atomic, assign) CGFloat contentsScale; // default=1.0f. See @contentsScaleForDisplay for more info @property (atomic, assign) CATransform3D transform; // default=CATransform3DIdentity @property (atomic, assign) CATransform3D subnodeTransform; // default=CATransform3DIdentity -@property (atomic, copy) NSString *name; // default=nil. Use this to tag your layers in the server-recurse-description / pca or for your own purposes +@property (atomic, copy, nullable) NSString *name; // default=nil. Use this to tag your layers in the server-recurse-description / pca or for your own purposes /** * @abstract The node view's background color. @@ -591,9 +593,9 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); * @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. /** @@ -617,18 +619,18 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); // 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 @@ -659,6 +661,7 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); - (void)addSubnode:(ASDisplayNode *)node; @end + @interface ASDisplayNode (Deprecated) - (void)reclaimMemory ASDISPLAYNODE_DEPRECATED; @@ -666,3 +669,5 @@ typedef void (^ASDisplayNodeDidLoadBlock)(ASDisplayNode *node); @property (nonatomic, assign) BOOL placeholderFadesOut ASDISPLAYNODE_DEPRECATED; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASDisplayNodeExtras.h b/AsyncDisplayKit/ASDisplayNodeExtras.h index 5ce6ac2ba5..521dce25dc 100644 --- a/AsyncDisplayKit/ASDisplayNodeExtras.h +++ b/AsyncDisplayKit/ASDisplayNodeExtras.h @@ -12,22 +12,24 @@ #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 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 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. @@ -35,29 +37,29 @@ extern id ASDisplayNodeFind(ASDisplayNode *node, BOOL (^block)(ASDisplayNode *no extern id ASDisplayNodeFindClass(ASDisplayNode *start, Class c); /** - 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. + 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-continuous 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(); @@ -69,3 +71,5 @@ extern void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); extern void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); ASDISPLAYNODE_EXTERN_C_END + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/ASDisplayNodeExtras.mm b/AsyncDisplayKit/ASDisplayNodeExtras.mm index 8d2e261570..e1af9e137b 100644 --- a/AsyncDisplayKit/ASDisplayNodeExtras.mm +++ b/AsyncDisplayKit/ASDisplayNodeExtras.mm @@ -54,7 +54,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) { @@ -79,14 +79,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]; @@ -110,12 +110,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 e343b4b420..232fd8ec65 100644 --- a/AsyncDisplayKit/ASEditableTextNode.h +++ b/AsyncDisplayKit/ASEditableTextNode.h @@ -8,6 +8,7 @@ #import +NS_ASSUME_NONNULL_BEGIN @protocol ASEditableTextNodeDelegate; @@ -26,7 +27,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; @@ -136,3 +137,5 @@ @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/AsyncDisplayKit/ASImageNode.h b/AsyncDisplayKit/ASImageNode.h index 8f71a06636..961da075f9 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. @@ -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. @@ -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 dce8d0f076..48bd06aa4f 100644 --- a/AsyncDisplayKit/ASImageNode.mm +++ b/AsyncDisplayKit/ASImageNode.mm @@ -260,7 +260,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/ASMultiplexImageNode.h b/AsyncDisplayKit/ASMultiplexImageNode.h index db10daa324..4ee7c7f1c8 100644 --- a/AsyncDisplayKit/ASMultiplexImageNode.h +++ b/AsyncDisplayKit/ASMultiplexImageNode.h @@ -9,10 +9,13 @@ #import #import +NS_ASSUME_NONNULL_BEGIN @protocol ASMultiplexImageNodeDelegate; @protocol ASMultiplexImageNodeDataSource; +typedef __kindof NSObject * ImageIdentifier; + extern NSString *const ASMultiplexImageNodeErrorDomain; /** @@ -77,7 +80,7 @@ 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 . @@ -91,12 +94,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) ImageIdentifier loadedImageIdentifier; /** * @abstract The identifier for the image that the receiver is currently displaying, or nil. */ -@property (nonatomic, readonly) id displayedImageIdentifier; +@property (nullable, nonatomic, readonly) ImageIdentifier displayedImageIdentifier; @end @@ -124,7 +127,7 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { */ - (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didUpdateDownloadProgress:(CGFloat)downloadProgress - forImageWithIdentifier:(id)imageIdentifier; + forImageWithIdentifier:(ImageIdentifier)imageIdentifier; /** * @abstract Notification that the image node's download has finished. @@ -133,8 +136,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:(ImageIdentifier)imageIdentifier + error:(nullable NSError *)error; /** * @abstract Notification that the image node's image was updated. @@ -147,10 +150,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 ImageIdentifier)imageIdentifier + fromImage:(nullable UIImage *)previousImage + withIdentifier:(nullable ImageIdentifier)previousImageIdentifier; /** * @abstract Notification that the image node displayed a new image. @@ -160,8 +163,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 ImageIdentifier)imageIdentifier; /** * @abstract Notification that the image node finished displaying an image. @@ -189,7 +192,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:(ImageIdentifier)imageIdentifier; /** * @abstract An image URL for the specified identifier. @@ -200,6 +203,8 @@ didFinishDownloadingImageWithIdentifier:(id)imageIdentifier * multiplexImageNode:imageForImageIdentifier:]> instead. * @returns An NSURL for the image identified by `imageIdentifier`, or nil if none is available. */ -- (NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(id)imageIdentifier; +- (nullable NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(ImageIdentifier)imageIdentifier; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASNetworkImageNode.h b/AsyncDisplayKit/ASNetworkImageNode.h index 5dc723521e..b3961e1060 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/ASScrollNode.h b/AsyncDisplayKit/ASScrollNode.h index a53090bd8f..de6c57551e 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 \ No newline at end of file diff --git a/AsyncDisplayKit/ASTableView.h b/AsyncDisplayKit/ASTableView.h index ed3ecd6212..3e42518b4d 100644 --- a/AsyncDisplayKit/ASTableView.h +++ b/AsyncDisplayKit/ASTableView.h @@ -18,6 +18,7 @@ @protocol ASTableViewDataSource; @protocol ASTableViewDelegate; +NS_ASSUME_NONNULL_BEGIN /** * Node-based table view. @@ -84,7 +85,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. @@ -120,7 +121,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. @@ -180,7 +181,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. @@ -192,7 +193,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. @@ -204,7 +205,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. @@ -232,7 +233,7 @@ * * @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" @@ -298,7 +299,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. @@ -334,3 +335,5 @@ @property (nonatomic, assign) ASRangeTuningParameters rangeTuningParameters ASDISPLAYNODE_DEPRECATED; @end + +NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASTableViewProtocols.h b/AsyncDisplayKit/ASTableViewProtocols.h index 844581790f..df8bb811ca 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 e8d5b76154..e7fdf85f53 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 @@ -75,14 +77,14 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { */ @property (nonatomic, readonly, assign) NSUInteger lineCount; -@property (nonatomic, strong) NSArray *exclusionPaths; +@property (nonatomic, strong) NSArray *exclusionPaths; #pragma mark - Placeholders /** @abstract The placeholder color. */ -@property (nonatomic, strong) UIColor *placeholderColor; +@property (nullable, nonatomic, strong) UIColor *placeholderColor; /** @abstract Inset each line of the placeholder. @@ -118,7 +120,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. @@ -129,7 +131,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. @@ -153,7 +155,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. @@ -162,7 +164,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. @@ -253,3 +255,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/examples/Swift/Sample.xcodeproj/project.pbxproj b/examples/Swift/Sample.xcodeproj/project.pbxproj index 4a845e166a..4aec090cdd 100644 --- a/examples/Swift/Sample.xcodeproj/project.pbxproj +++ b/examples/Swift/Sample.xcodeproj/project.pbxproj @@ -128,6 +128,8 @@ 050E7C6619D22E19004363C2 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftMigration = 0700; + LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0600; ORGANIZATIONNAME = Facebook; TargetAttributes = { diff --git a/examples/Swift/Sample/ViewController.swift b/examples/Swift/Sample/ViewController.swift index 9801a20523..037e0965e8 100644 --- a/examples/Swift/Sample/ViewController.swift +++ b/examples/Swift/Sample/ViewController.swift @@ -27,7 +27,7 @@ class ViewController: UIViewController, ASTableViewDataSource, ASTableViewDelega self.tableView.asyncDelegate = self } - required init(coder aDecoder: NSCoder) { + required init?(coder aDecoder: NSCoder) { fatalError("storyboards are incompatible with truth and beauty") }