diff --git a/Source/ASCellNode.h b/Source/ASCellNode.h index e7f25e92..ff54828d 100644 --- a/Source/ASCellNode.h +++ b/Source/ASCellNode.h @@ -148,10 +148,10 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { * 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:(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; +- (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event NS_REQUIRES_SUPER; +- (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event NS_REQUIRES_SUPER; +- (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event NS_REQUIRES_SUPER; +- (void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event NS_REQUIRES_SUPER; /** * Called by the system when ASCellNode is used with an ASCollectionNode. It will not be called by ASTableNode. @@ -221,7 +221,7 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { - (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; -- (void)setLayerBacked:(BOOL)layerBacked AS_UNAVAILABLE("ASCellNode does not support layer-backing, although subnodes may be layer-backed."); +- (void)setLayerBacked:(BOOL)layerBacked AS_UNAVAILABLE_MSG("ASCellNode does not support layer-backing, although subnodes may be layer-backed."); @end diff --git a/Source/ASCollectionNode+Beta.h b/Source/ASCollectionNode+Beta.h index 506f9dc2..8bac08d1 100644 --- a/Source/ASCollectionNode+Beta.h +++ b/Source/ASCollectionNode+Beta.h @@ -74,11 +74,11 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithLayoutDelegate:(id)layoutDelegate layoutFacilitator:(nullable id)layoutFacilitator; -- (void)beginUpdates ASDISPLAYNODE_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); +- (void)beginUpdates AS_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); -- (void)endUpdatesAnimated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); +- (void)endUpdatesAnimated:(BOOL)animated AS_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); -- (void)endUpdatesAnimated:(BOOL)animated completion:(nullable void (^)(BOOL))completion ASDISPLAYNODE_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); +- (void)endUpdatesAnimated:(BOOL)animated completion:(nullable void (^)(BOOL))completion AS_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); - (void)invalidateFlowLayoutDelegateMetrics; diff --git a/Source/ASCollectionNode.h b/Source/ASCollectionNode.h index 194f31f0..466d4775 100644 --- a/Source/ASCollectionNode.h +++ b/Source/ASCollectionNode.h @@ -268,7 +268,7 @@ NS_ASSUME_NONNULL_BEGIN * 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:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; +- (void)performBatchAnimated:(BOOL)animated updates:(nullable void (NS_NOESCAPE ^)(void))updates completion:(nullable void (^)(BOOL finished))completion; /** * Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. @@ -279,7 +279,7 @@ NS_ASSUME_NONNULL_BEGIN * 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:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; +- (void)performBatchUpdates:(nullable void (NS_NOESCAPE ^)(void))updates completion:(nullable void (^)(BOOL finished))completion; /** * Returns YES if the ASCollectionNode is still processing changes from performBatchUpdates:. @@ -553,7 +553,7 @@ NS_ASSUME_NONNULL_BEGIN @interface ASCollectionNode (Deprecated) -- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("This method has been renamed to -waitUntilAllUpdatesAreProcessed."); +- (void)waitUntilAllUpdatesAreCommitted AS_DEPRECATED_MSG("This method has been renamed to -waitUntilAllUpdatesAreProcessed."); @end @@ -691,7 +691,7 @@ NS_ASSUME_NONNULL_BEGIN * not implement reuse (it will be called once per row). Unlike UICollectionView's version, * this method is not called when the row is about to display. */ -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); /** * Similar to -collectionView:nodeForItemAtIndexPath: @@ -705,7 +705,7 @@ NS_ASSUME_NONNULL_BEGIN * Must be thread-safe (can be called on the main thread or a background * queue) and should not implement reuse (it will be called once per row). */ -- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); /** * Asks the collection view to provide a supplementary node to display in the collection view. @@ -714,7 +714,7 @@ NS_ASSUME_NONNULL_BEGIN * @param kind The kind of supplementary node to provide. * @param indexPath The index path that specifies the location of the new supplementary node. */ -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); /** * Indicator to lock the data source for data fetching in async mode. @@ -724,7 +724,7 @@ NS_ASSUME_NONNULL_BEGIN * @param collectionView The sender. * @deprecated The data source is always accessed on the main thread, and this method will not be called. */ -- (void)collectionViewLockDataSource:(ASCollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); +- (void)collectionViewLockDataSource:(ASCollectionView *)collectionView AS_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); /** * Indicator to unlock the data source for data fetching in async mode. @@ -734,7 +734,7 @@ NS_ASSUME_NONNULL_BEGIN * @param collectionView The sender. * @deprecated The data source is always accessed on the main thread, and this method will not be called. */ -- (void)collectionViewUnlockDataSource:(ASCollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); +- (void)collectionViewUnlockDataSource:(ASCollectionView *)collectionView AS_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); @end @@ -812,7 +812,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return A constrained size range for layout the node at this index path. */ -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's constrainedSizeForItemAtIndexPath: instead. PLEASE NOTE the very subtle method name change."); +- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASCollectionNode's constrainedSizeForItemAtIndexPath: instead. PLEASE NOTE the very subtle method name change."); /** * Informs the delegate that the collection view will add the given node @@ -826,7 +826,7 @@ NS_ASSUME_NONNULL_BEGIN * passed into this method may not correspond to the same item in your data source * if your data source has been updated since the last edit was processed. */ -- (void)collectionView:(ASCollectionView *)collectionView willDisplayNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (void)collectionView:(ASCollectionView *)collectionView willDisplayNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); /** * Informs the delegate that the collection view did remove the provided node from the view hierarchy. @@ -841,9 +841,9 @@ NS_ASSUME_NONNULL_BEGIN * passed into this method may not correspond to the same item in your data source * if your data source has been updated since the last edit was processed. */ -- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); -- (void)collectionView:(ASCollectionView *)collectionView willBeginBatchFetchWithContext:(ASBatchContext *)context ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (void)collectionView:(ASCollectionView *)collectionView willBeginBatchFetchWithContext:(ASBatchContext *)context AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); /** * Tell the collectionView if batch fetching should begin. @@ -856,7 +856,7 @@ NS_ASSUME_NONNULL_BEGIN * If not implemented, the collectionView assumes that it should notify its asyncDelegate when batch fetching * should occur. */ -- (BOOL)shouldBatchFetchForCollectionView:(ASCollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (BOOL)shouldBatchFetchForCollectionView:(ASCollectionView *)collectionView AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); /** * Informs the delegate that the collection view will add the node @@ -871,7 +871,7 @@ NS_ASSUME_NONNULL_BEGIN * * This method is deprecated. Use @c collectionView:willDisplayNode:forItemAtIndexPath: instead. */ -- (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); @end diff --git a/Source/ASCollectionView.h b/Source/ASCollectionView.h index 33608617..daf56f58 100644 --- a/Source/ASCollectionView.h +++ b/Source/ASCollectionView.h @@ -96,14 +96,14 @@ NS_ASSUME_NONNULL_BEGIN /* * A Boolean value that determines whether the nodes that the data source renders will be flipped. */ -@property (nonatomic) BOOL inverted ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); +@property (nonatomic) BOOL inverted AS_DEPRECATED_MSG("Use ASCollectionNode property instead."); /** * The number of screens left to scroll before the delegate -collectionView:beginBatchFetchingWithContext: is called. * * Defaults to two screenfuls. */ -@property (nonatomic) CGFloat leadingScreensForBatching ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); +@property (nonatomic) CGFloat leadingScreensForBatching AS_DEPRECATED_MSG("Use ASCollectionNode property instead."); /** * Optional introspection object for the collection view's layout. @@ -115,21 +115,21 @@ NS_ASSUME_NONNULL_BEGIN * collection view layout subclasses will need to provide their own implementation of an inspector object for their * supplementary views to be compatible with `ASCollectionView`'s supplementary node support. */ -@property (nonatomic, weak) id layoutInspector ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); +@property (nonatomic, weak) id layoutInspector AS_DEPRECATED_MSG("Use ASCollectionNode property instead."); /** * Determines collection view's current scroll direction. Supports 2-axis collection views. * * @return a bitmask of ASScrollDirection values. */ -@property (nonatomic, readonly) ASScrollDirection scrollDirection ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); +@property (nonatomic, readonly) ASScrollDirection scrollDirection AS_DEPRECATED_MSG("Use ASCollectionNode property instead."); /** * Determines collection view's scrollable directions. * * @return a bitmask of ASScrollDirection values. */ -@property (nonatomic, readonly) ASScrollDirection scrollableDirections ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); +@property (nonatomic, readonly) ASScrollDirection scrollableDirections AS_DEPRECATED_MSG("Use ASCollectionNode property instead."); /** * Forces the .contentInset to be UIEdgeInsetsZero. @@ -139,17 +139,17 @@ NS_ASSUME_NONNULL_BEGIN * automaticallyAdjustsScrollViewInsets, which may not be accessible. ASPagerNode uses this to ensure * its flow layout behaves predictably and does not log undefined layout warnings. */ -@property (nonatomic) BOOL zeroContentInsets ASDISPLAYNODE_DEPRECATED_MSG("Set automaticallyAdjustsScrollViewInsets=NO on your view controller instead."); +@property (nonatomic) BOOL zeroContentInsets AS_DEPRECATED_MSG("Set automaticallyAdjustsScrollViewInsets=NO on your view controller instead."); /** * The distance that the content view is inset from the collection view edges. Defaults to UIEdgeInsetsZero. */ -@property (nonatomic) UIEdgeInsets contentInset ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead"); +@property (nonatomic) UIEdgeInsets contentInset AS_DEPRECATED_MSG("Use ASCollectionNode property instead"); /** * The point at which the origin of the content view is offset from the origin of the collection view. */ -@property (nonatomic) CGPoint contentOffset ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); +@property (nonatomic) CGPoint contentOffset AS_DEPRECATED_MSG("Use ASCollectionNode property instead."); /** * The object that acts as the asynchronous delegate of the collection view @@ -158,7 +158,7 @@ NS_ASSUME_NONNULL_BEGIN * * The delegate object is responsible for providing size constraints for nodes and indicating whether batch fetching should begin. */ -@property (nonatomic, weak) id asyncDelegate ASDISPLAYNODE_DEPRECATED_MSG("Please use ASCollectionNode's .delegate property instead."); +@property (nonatomic, weak) id asyncDelegate AS_DEPRECATED_MSG("Please use ASCollectionNode's .delegate property instead."); /** * The object that acts as the asynchronous data source of the collection view @@ -167,7 +167,7 @@ NS_ASSUME_NONNULL_BEGIN * * The datasource object is responsible for providing nodes or node creation blocks to the collection view. */ -@property (nonatomic, weak) id asyncDataSource ASDISPLAYNODE_DEPRECATED_MSG("Please use ASCollectionNode's .dataSource property instead."); +@property (nonatomic, weak) id asyncDataSource AS_DEPRECATED_MSG("Please use ASCollectionNode's .dataSource property instead."); /** * Initializes an ASCollectionView @@ -176,7 +176,7 @@ NS_ASSUME_NONNULL_BEGIN * * @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil. */ -- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout ASDISPLAYNODE_DEPRECATED_MSG("Please use ASCollectionNode instead of ASCollectionView."); +- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout AS_DEPRECATED_MSG("Please use ASCollectionNode instead of ASCollectionView."); /** * Initializes an ASCollectionView @@ -186,7 +186,7 @@ NS_ASSUME_NONNULL_BEGIN * @param frame The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization. * @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil. */ -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout ASDISPLAYNODE_DEPRECATED_MSG("Please use ASCollectionNode instead of ASCollectionView."); +- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout AS_DEPRECATED_MSG("Please use ASCollectionNode instead of ASCollectionView."); /** * Tuning parameters for a range type in full mode. @@ -198,7 +198,7 @@ NS_ASSUME_NONNULL_BEGIN * @see ASLayoutRangeMode * @see ASLayoutRangeType */ -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Set the tuning parameters for a range type in full mode. @@ -209,7 +209,7 @@ NS_ASSUME_NONNULL_BEGIN * @see ASLayoutRangeMode * @see ASLayoutRangeType */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Tuning parameters for a range type in the specified mode. @@ -222,7 +222,7 @@ NS_ASSUME_NONNULL_BEGIN * @see ASLayoutRangeMode * @see ASLayoutRangeType */ -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Set the tuning parameters for a range type in the specified mode. @@ -234,17 +234,17 @@ NS_ASSUME_NONNULL_BEGIN * @see ASLayoutRangeMode * @see ASLayoutRangeType */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); -- (nullable __kindof UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (nullable __kindof UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); -- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); -- (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); -@property (nonatomic, copy, readonly) NSArray *indexPathsForVisibleItems ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); +@property (nonatomic, copy, readonly) NSArray *indexPathsForVisibleItems AS_DEPRECATED_MSG("Use ASCollectionNode property instead."); -@property (nullable, nonatomic, copy, readonly) NSArray *indexPathsForSelectedItems ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); +@property (nullable, nonatomic, copy, readonly) NSArray *indexPathsForSelectedItems AS_DEPRECATED_MSG("Use ASCollectionNode property instead."); /** * Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. @@ -256,7 +256,7 @@ NS_ASSUME_NONNULL_BEGIN * 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:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)performBatchAnimated:(BOOL)animated updates:(nullable void (NS_NOESCAPE ^)(void))updates completion:(nullable void (^)(BOOL finished))completion AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Perform a batch of updates asynchronously. This method must be called from the main thread. @@ -267,7 +267,7 @@ NS_ASSUME_NONNULL_BEGIN * 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:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)performBatchUpdates:(nullable void (NS_NOESCAPE ^)(void))updates completion:(nullable void (^)(BOOL finished))completion AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -276,28 +276,28 @@ NS_ASSUME_NONNULL_BEGIN * the main thread. * @warning This method is substantially more expensive than UICollectionView's version. */ -- (void)reloadDataWithCompletion:(nullable void (^)(void))completion AS_UNAVAILABLE("Use ASCollectionNode method instead."); +- (void)reloadDataWithCompletion:(nullable void (^)(void))completion AS_UNAVAILABLE_MSG("Use ASCollectionNode method instead."); /** * Reload everything from scratch, destroying the working range and all cached nodes. * * @warning This method is substantially more expensive than UICollectionView's version. */ -- (void)reloadData AS_UNAVAILABLE("Use ASCollectionNode method instead."); +- (void)reloadData AS_UNAVAILABLE_MSG("Use ASCollectionNode method instead."); /** * Triggers a relayout of all nodes. * * @discussion This method invalidates and lays out every cell node in the collection. */ -- (void)relayoutItems ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)relayoutItems AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * See ASCollectionNode.h for full documentation of these methods. */ @property (nonatomic, readonly) BOOL isProcessingUpdates; - (void)onDidFinishProcessingUpdates:(void (^)(void))completion; -- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("Use -[ASCollectionNode waitUntilAllUpdatesAreProcessed] instead."); +- (void)waitUntilAllUpdatesAreCommitted AS_DEPRECATED_MSG("Use -[ASCollectionNode waitUntilAllUpdatesAreProcessed] instead."); /** * See ASCollectionNode.h for full documentation of these methods. @@ -315,7 +315,7 @@ NS_ASSUME_NONNULL_BEGIN * methods. This method will register an internal backing view that will host the contents of the supplementary nodes * returned from the data source. */ -- (void)registerSupplementaryNodeOfKind:(NSString *)elementKind ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)registerSupplementaryNodeOfKind:(NSString *)elementKind AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Inserts one or more sections. @@ -325,7 +325,7 @@ NS_ASSUME_NONNULL_BEGIN * @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)insertSections:(NSIndexSet *)sections ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)insertSections:(NSIndexSet *)sections AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Deletes one or more sections. @@ -335,7 +335,7 @@ NS_ASSUME_NONNULL_BEGIN * @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)deleteSections:(NSIndexSet *)sections ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)deleteSections:(NSIndexSet *)sections AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Reloads the specified sections. @@ -345,7 +345,7 @@ NS_ASSUME_NONNULL_BEGIN * @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)reloadSections:(NSIndexSet *)sections ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)reloadSections:(NSIndexSet *)sections AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Moves a section to a new location. @@ -357,7 +357,7 @@ NS_ASSUME_NONNULL_BEGIN * @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)moveSection:(NSInteger)section toSection:(NSInteger)newSection ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Inserts items at the locations identified by an array of index paths. @@ -367,7 +367,7 @@ NS_ASSUME_NONNULL_BEGIN * @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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Deletes the items specified by an array of index paths. @@ -377,7 +377,7 @@ NS_ASSUME_NONNULL_BEGIN * @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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Reloads the specified items. @@ -387,7 +387,7 @@ NS_ASSUME_NONNULL_BEGIN * @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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Moves the item at a specified location to a destination location. @@ -399,7 +399,7 @@ NS_ASSUME_NONNULL_BEGIN * @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)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Query the sized node at @c indexPath for its calculatedSize. @@ -408,24 +408,24 @@ NS_ASSUME_NONNULL_BEGIN * * This method is deprecated. Call @c calculatedSize on the node of interest instead. First deprecated in version 2.0. */ -- (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Call -calculatedSize on the node of interest instead."); +- (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Call -calculatedSize on the node of interest instead."); /** * Similar to -visibleCells. * * @return an array containing the nodes being displayed on screen. */ -- (NSArray<__kindof ASCellNode *> *)visibleNodes AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (NSArray<__kindof ASCellNode *> *)visibleNodes AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated AS_DEPRECATED_MSG("Use ASCollectionNode method instead."); @end -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASCollectionDataSource.") +AS_DEPRECATED_MSG("Renamed to ASCollectionDataSource.") @protocol ASCollectionViewDataSource @end -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASCollectionDelegate.") +AS_DEPRECATED_MSG("Renamed to ASCollectionDelegate.") @protocol ASCollectionViewDelegate @end @@ -484,16 +484,16 @@ ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASCollectionDelegate.") /** * Asks the delegate for the size of the header in the specified section. */ -- (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:sizeRangeForHeaderInSection: instead."); +- (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section AS_DEPRECATED_MSG("Implement collectionNode:sizeRangeForHeaderInSection: instead."); /** * Asks the delegate for the size of the footer in the specified section. */ -- (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:sizeRangeForFooterInSection: instead."); +- (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section AS_DEPRECATED_MSG("Implement collectionNode:sizeRangeForFooterInSection: instead."); @end -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASCollectionDelegateFlowLayout.") +AS_DEPRECATED_MSG("Renamed to ASCollectionDelegateFlowLayout.") @protocol ASCollectionViewDelegateFlowLayout @end diff --git a/Source/ASCollectionViewProtocols.h b/Source/ASCollectionViewProtocols.h index 42d6b37c..f663b1a8 100644 --- a/Source/ASCollectionViewProtocols.h +++ b/Source/ASCollectionViewProtocols.h @@ -29,11 +29,11 @@ NS_ASSUME_NONNULL_BEGIN @optional -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section ASDISPLAYNODE_DEPRECATED_MSG("Implement -collectionNode:numberOfItemsInSection: instead."); +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section AS_DEPRECATED_MSG("Implement -collectionNode:numberOfItemsInSection: instead."); -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Implement -numberOfSectionsInCollectionNode: instead."); +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView AS_DEPRECATED_MSG("Implement -numberOfSectionsInCollectionNode: instead."); -- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement - collectionNode:nodeForSupplementaryElementOfKind:atIndexPath: instead."); +- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement - collectionNode:nodeForSupplementaryElementOfKind:atIndexPath: instead."); @end @@ -49,21 +49,21 @@ NS_ASSUME_NONNULL_BEGIN - (UICollectionViewTransitionLayout *)collectionView:(UICollectionView *)collectionView transitionLayoutForOldLayout:(UICollectionViewLayout *)fromLayout newLayout:(UICollectionViewLayout *)toLayout; -- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -collectionNode:willDisplaySupplementaryView:forElementKind:atIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -collectionNode:didEndDisplayingSupplementaryView:forElementKind:atIndexPath: instead."); +- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -collectionNode:willDisplaySupplementaryView:forElementKind:atIndexPath: instead."); +- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -collectionNode:didEndDisplayingSupplementaryView:forElementKind:atIndexPath: instead."); -- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:shouldHighlightItemAtIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:didHighlightItemAtIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:didUnhighlightItemAtIndexPath: instead."); +- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement collectionNode:shouldHighlightItemAtIndexPath: instead."); +- (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement collectionNode:didHighlightItemAtIndexPath: instead."); +- (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement collectionNode:didUnhighlightItemAtIndexPath: instead."); -- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:shouldSelectItemAtIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:didSelectItemAtIndexPath: instead."); -- (BOOL)collectionView:(UICollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:shouldDeselectItemAtIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:didDeselectItemAtIndexPath: instead."); +- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement collectionNode:shouldSelectItemAtIndexPath: instead."); +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement collectionNode:didSelectItemAtIndexPath: instead."); +- (BOOL)collectionView:(UICollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement collectionNode:shouldDeselectItemAtIndexPath: instead."); +- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement collectionNode:didDeselectItemAtIndexPath: instead."); -- (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:shouldShowMenuForItemAtIndexPath: instead."); -- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:canPerformAction:forItemAtIndexPath:withSender: instead."); -- (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:performAction:forItemAtIndexPath:withSender: instead."); +- (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement collectionNode:shouldShowMenuForItemAtIndexPath: instead."); +- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender AS_DEPRECATED_MSG("Implement collectionNode:canPerformAction:forItemAtIndexPath:withSender: instead."); +- (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender AS_DEPRECATED_MSG("Implement collectionNode:performAction:forItemAtIndexPath:withSender: instead."); @end diff --git a/Source/ASConfigurationInternal.h b/Source/ASConfigurationInternal.h index 2a7d7e4f..0d2662ac 100644 --- a/Source/ASConfigurationInternal.h +++ b/Source/ASConfigurationInternal.h @@ -17,7 +17,6 @@ #import NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** * Quickly check if an experiment is enabled and notify the delegate @@ -25,7 +24,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN * * The delegate will be notified asynchronously. */ -BOOL ASActivateExperimentalFeature(ASExperimentalFeatures option); +AS_EXTERN BOOL ASActivateExperimentalFeature(ASExperimentalFeatures option); AS_SUBCLASSING_RESTRICTED @interface ASConfigurationManager : NSObject @@ -38,4 +37,3 @@ AS_SUBCLASSING_RESTRICTED @end NS_ASSUME_NONNULL_END -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/ASContextTransitioning.h b/Source/ASContextTransitioning.h index 8982211b..f433b85f 100644 --- a/Source/ASContextTransitioning.h +++ b/Source/ASContextTransitioning.h @@ -22,8 +22,8 @@ NS_ASSUME_NONNULL_BEGIN -extern NSString * const ASTransitionContextFromLayoutKey; -extern NSString * const ASTransitionContextToLayoutKey; +AS_EXTERN NSString * const ASTransitionContextFromLayoutKey; +AS_EXTERN NSString * const ASTransitionContextToLayoutKey; @protocol ASContextTransitioning diff --git a/Source/ASControlNode.h b/Source/ASControlNode.h index a3cc8b23..f864b77e 100644 --- a/Source/ASControlNode.h +++ b/Source/ASControlNode.h @@ -58,11 +58,11 @@ typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent) * Apple's UIControlState enum gets special treatment here, and * UIControlStateNormal is available in Swift. */ -typedef UIControlState ASControlState ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlState."); -static UIControlState const ASControlStateNormal ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlStateNormal.") = UIControlStateNormal; -static UIControlState const ASControlStateDisabled ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlStateDisabled.") = UIControlStateDisabled; -static UIControlState const ASControlStateHighlighted ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlStateHighlighted.") = UIControlStateHighlighted; -static UIControlState const ASControlStateSelected ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlStateSelected.") = UIControlStateSelected; +typedef UIControlState ASControlState AS_DEPRECATED_MSG("Use UIControlState."); +static UIControlState const ASControlStateNormal AS_DEPRECATED_MSG("Use UIControlStateNormal.") = UIControlStateNormal; +static UIControlState const ASControlStateDisabled AS_DEPRECATED_MSG("Use UIControlStateDisabled.") = UIControlStateDisabled; +static UIControlState const ASControlStateHighlighted AS_DEPRECATED_MSG("Use UIControlStateHighlighted.") = UIControlStateHighlighted; +static UIControlState const ASControlStateSelected AS_DEPRECATED_MSG("Use UIControlStateSelected.") = UIControlStateSelected; /** @abstract ASControlNode is the base class for control nodes (such as buttons), or nodes that track touches to invoke targets with action messages. diff --git a/Source/ASDisplayNode+Beta.h b/Source/ASDisplayNode+Beta.h index e4b4df1a..cd42006c 100644 --- a/Source/ASDisplayNode+Beta.h +++ b/Source/ASDisplayNode+Beta.h @@ -27,10 +27,8 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN -void ASPerformBlockOnMainThread(void (^block)(void)); -void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); +AS_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT #if ASEVENTLOG_ENABLE #define ASDisplayNodeLogEvent(node, ...) [node.eventLog logEventWithBacktrace:(AS_SAVE_EVENT_BACKTRACES ? [NSThread callStackSymbols] : nil) format:__VA_ARGS__] @@ -167,7 +165,7 @@ typedef struct { #if YOGA -extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullable node, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullable node, void(^block)(ASDisplayNode *node)); @interface ASDisplayNode (Yoga) diff --git a/Source/ASDisplayNode+Layout.mm b/Source/ASDisplayNode+Layout.mm index 239057e3..3990e955 100644 --- a/Source/ASDisplayNode+Layout.mm +++ b/Source/ASDisplayNode+Layout.mm @@ -197,7 +197,7 @@ ASLayoutElementStyleExtensibilityForwarding @implementation ASDisplayNode (ASLayoutElementStylability) -- (instancetype)styledWithBlock:(AS_NOESCAPE void (^)(__kindof ASLayoutElementStyle *style))styleBlock +- (instancetype)styledWithBlock:(void (NS_NOESCAPE ^)(__kindof ASLayoutElementStyle *style))styleBlock { styleBlock(self.style); return self; diff --git a/Source/ASDisplayNode+Subclasses.h b/Source/ASDisplayNode+Subclasses.h index 43f1c235..bc6f04b3 100644 --- a/Source/ASDisplayNode+Subclasses.h +++ b/Source/ASDisplayNode+Subclasses.h @@ -144,7 +144,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion This is the best time to add gesture recognizers to the view. */ -- (void)didLoad ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didLoad NS_REQUIRES_SUPER; #pragma mark - Layout @@ -155,7 +155,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion Subclasses override this method to layout all subnodes or subviews. */ -- (void)layout ASDISPLAYNODE_REQUIRES_SUPER; +- (void)layout NS_REQUIRES_SUPER; /** * @abstract Called on the main thread by the view's -layoutSubviews, after -layout. @@ -163,7 +163,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion Gives a chance for subclasses to perform actions after the subclass and superclass have finished laying * out. */ -- (void)layoutDidFinish ASDISPLAYNODE_REQUIRES_SUPER; +- (void)layoutDidFinish NS_REQUIRES_SUPER; /** * @abstract Called on a background thread if !isNodeLoaded - called on the main thread if isNodeLoaded. @@ -171,7 +171,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion When the .calculatedLayout property is set to a new ASLayout (directly from -calculateLayoutThatFits: or * calculated via use of -layoutSpecThatFits:), subclasses may inspect it here. */ -- (void)calculatedLayoutDidChange ASDISPLAYNODE_REQUIRES_SUPER; +- (void)calculatedLayoutDidChange NS_REQUIRES_SUPER; #pragma mark - Layout calculation @@ -255,17 +255,17 @@ NS_ASSUME_NONNULL_BEGIN * For descriptions, see definition. */ -- (void)didEnterVisibleState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitVisibleState ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didEnterVisibleState NS_REQUIRES_SUPER; +- (void)didExitVisibleState NS_REQUIRES_SUPER; -- (void)didEnterDisplayState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitDisplayState ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didEnterDisplayState NS_REQUIRES_SUPER; +- (void)didExitDisplayState NS_REQUIRES_SUPER; -- (void)didEnterPreloadState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitPreloadState ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didEnterPreloadState NS_REQUIRES_SUPER; +- (void)didExitPreloadState NS_REQUIRES_SUPER; - (void)interfaceStateDidChange:(ASInterfaceState)newState - fromState:(ASInterfaceState)oldState ASDISPLAYNODE_REQUIRES_SUPER; + fromState:(ASInterfaceState)oldState NS_REQUIRES_SUPER; /** * @abstract Called when the node's ASTraitCollection changes @@ -292,7 +292,7 @@ NS_ASSUME_NONNULL_BEGIN * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) */ + (void)drawRect:(CGRect)bounds withParameters:(nullable id)parameters - isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock + isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing; /** @@ -309,7 +309,7 @@ NS_ASSUME_NONNULL_BEGIN * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) */ + (nullable UIImage *)displayWithParameters:(nullable id)parameters - isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock; + isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock; /** * @abstract Delegate override for drawParameters @@ -330,7 +330,7 @@ NS_ASSUME_NONNULL_BEGIN * * @note Called on the main thread only */ -- (void)displayWillStart ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use displayWillStartAsynchronously: instead."); +- (void)displayWillStart NS_REQUIRES_SUPER AS_DEPRECATED_MSG("Use displayWillStartAsynchronously: instead."); /** * @abstract Indicates that the receiver is about to display. @@ -340,7 +340,7 @@ NS_ASSUME_NONNULL_BEGIN * * @note Called on the main thread only */ -- (void)displayWillStartAsynchronously:(BOOL)asynchronously ASDISPLAYNODE_REQUIRES_SUPER; +- (void)displayWillStartAsynchronously:(BOOL)asynchronously NS_REQUIRES_SUPER; /** * @abstract Indicates that the receiver has finished displaying. @@ -350,23 +350,23 @@ NS_ASSUME_NONNULL_BEGIN * * @note Called on the main thread only */ -- (void)displayDidFinish ASDISPLAYNODE_REQUIRES_SUPER; +- (void)displayDidFinish NS_REQUIRES_SUPER; /** * Called just before the view is added to a window. */ -- (void)willEnterHierarchy ASDISPLAYNODE_REQUIRES_SUPER; +- (void)willEnterHierarchy NS_REQUIRES_SUPER; /** * Called after the view is removed from the window. */ -- (void)didExitHierarchy ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didExitHierarchy NS_REQUIRES_SUPER; /** * Called just after the view is added to a window. * Note: this may be called multiple times during view controller transitions. To overcome this: use didEnterVisibleState or its equavalents. */ -- (void)didEnterHierarchy ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didEnterHierarchy NS_REQUIRES_SUPER; /** * @abstract Whether the view or layer of this display node is currently in a window @@ -380,7 +380,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion Called by -recursivelyClearContents. Always called on main thread. Base class implements self.contents = nil, clearing any backing * store, for asynchronous regeneration when needed. */ -- (void)clearContents ASDISPLAYNODE_REQUIRES_SUPER; +- (void)clearContents NS_REQUIRES_SUPER; /** * @abstract Indicates that the receiver is about to display its subnodes. This method is not called if there are no @@ -391,7 +391,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion Subclasses may override this method to be notified when subnode display (asynchronous or synchronous) is * about to begin. */ -- (void)subnodeDisplayWillStart:(ASDisplayNode *)subnode ASDISPLAYNODE_REQUIRES_SUPER; +- (void)subnodeDisplayWillStart:(ASDisplayNode *)subnode NS_REQUIRES_SUPER; /** * @abstract Indicates that the receiver is finished displaying its subnodes. This method is not called if there are @@ -402,7 +402,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion Subclasses may override this method to be notified when subnode display (asynchronous or synchronous) has * completed. */ -- (void)subnodeDisplayDidFinish:(ASDisplayNode *)subnode ASDISPLAYNODE_REQUIRES_SUPER; +- (void)subnodeDisplayDidFinish:(ASDisplayNode *)subnode NS_REQUIRES_SUPER; /** * @abstract Marks the receiver's bounds as needing to be redrawn, with a scale value. @@ -452,7 +452,7 @@ NS_ASSUME_NONNULL_BEGIN * @param touches A set of UITouch instances. * @param event A UIEvent associated with the touch. */ -- (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; +- (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event NS_REQUIRES_SUPER; /** * @abstract Tells the node when touches moved in its view. @@ -460,7 +460,7 @@ NS_ASSUME_NONNULL_BEGIN * @param touches A set of UITouch instances. * @param event A UIEvent associated with the touch. */ -- (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; +- (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event NS_REQUIRES_SUPER; /** * @abstract Tells the node when touches ended in its view. @@ -468,7 +468,7 @@ NS_ASSUME_NONNULL_BEGIN * @param touches A set of UITouch instances. * @param event A UIEvent associated with the touch. */ -- (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; +- (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event NS_REQUIRES_SUPER; /** * @abstract Tells the node when touches was cancelled in its view. @@ -476,7 +476,7 @@ NS_ASSUME_NONNULL_BEGIN * @param touches A set of UITouch instances. * @param event A UIEvent associated with the touch. */ -- (void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; +- (void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event NS_REQUIRES_SUPER; #pragma mark - Managing Gesture Recognizers diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index 131069a9..e8dcb03c 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -110,7 +110,7 @@ typedef NS_ENUM(NSInteger, ASCornerRoundingType) { /** * Default drawing priority for display node */ -extern NSInteger const ASDefaultDrawingPriority; +AS_EXTERN NSInteger const ASDefaultDrawingPriority; /** * An `ASDisplayNode` is an abstraction over `UIView` and `CALayer` that allows you to perform calculations about a view diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index e7055228..932deae0 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -2022,7 +2022,7 @@ static inline CATransform3D _calculateTransformFromReferenceToTarget(ASDisplayNo #pragma mark - Managing the Node Hierarchy -ASDISPLAYNODE_INLINE bool shouldDisableNotificationsForMovingBetweenParents(ASDisplayNode *from, ASDisplayNode *to) { +AS_INLINE bool shouldDisableNotificationsForMovingBetweenParents(ASDisplayNode *from, ASDisplayNode *to) { if (!from || !to) return NO; if (from.isSynchronous) return NO; if (to.isSynchronous) return NO; @@ -2031,17 +2031,17 @@ ASDISPLAYNODE_INLINE bool shouldDisableNotificationsForMovingBetweenParents(ASDi } /// Returns incremented value of i if i is not NSNotFound -ASDISPLAYNODE_INLINE NSInteger incrementIfFound(NSInteger i) { +AS_INLINE NSInteger incrementIfFound(NSInteger i) { return i == NSNotFound ? NSNotFound : i + 1; } /// Returns if a node is a member of a rasterized tree -ASDISPLAYNODE_INLINE BOOL canUseViewAPI(ASDisplayNode *node, ASDisplayNode *subnode) { +AS_INLINE BOOL canUseViewAPI(ASDisplayNode *node, ASDisplayNode *subnode) { return (subnode.isLayerBacked == NO && node.isLayerBacked == NO); } /// Returns if node is a member of a rasterized tree -ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { +AS_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { return (node.rasterizesSubtree || (node.hierarchyState & ASHierarchyStateRasterized)); } diff --git a/Source/ASDisplayNodeExtras.h b/Source/ASDisplayNodeExtras.h index afe00fdd..947b3f65 100644 --- a/Source/ASDisplayNodeExtras.h +++ b/Source/ASDisplayNodeExtras.h @@ -36,34 +36,33 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /// For deallocation of objects on the main thread across multiple run loops. -extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr); +AS_EXTERN void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr); // Because inline methods can't be extern'd and need to be part of the translation unit of code // that compiles with them to actually inline, we both declare and define these in the header. -ASDISPLAYNODE_INLINE BOOL ASInterfaceStateIncludesVisible(ASInterfaceState interfaceState) +AS_INLINE BOOL ASInterfaceStateIncludesVisible(ASInterfaceState interfaceState) { return ((interfaceState & ASInterfaceStateVisible) == ASInterfaceStateVisible); } -ASDISPLAYNODE_INLINE BOOL ASInterfaceStateIncludesDisplay(ASInterfaceState interfaceState) +AS_INLINE BOOL ASInterfaceStateIncludesDisplay(ASInterfaceState interfaceState) { return ((interfaceState & ASInterfaceStateDisplay) == ASInterfaceStateDisplay); } -ASDISPLAYNODE_INLINE BOOL ASInterfaceStateIncludesPreload(ASInterfaceState interfaceState) +AS_INLINE BOOL ASInterfaceStateIncludesPreload(ASInterfaceState interfaceState) { return ((interfaceState & ASInterfaceStatePreload) == ASInterfaceStatePreload); } -ASDISPLAYNODE_INLINE BOOL ASInterfaceStateIncludesMeasureLayout(ASInterfaceState interfaceState) +AS_INLINE BOOL ASInterfaceStateIncludesMeasureLayout(ASInterfaceState interfaceState) { return ((interfaceState & ASInterfaceStateMeasureLayout) == ASInterfaceStateMeasureLayout); } -__unused static NSString * NSStringFromASInterfaceState(ASInterfaceState interfaceState) +__unused AS_INLINE NSString * NSStringFromASInterfaceState(ASInterfaceState interfaceState) { NSMutableArray *states = [NSMutableArray array]; if (interfaceState == ASInterfaceStateNone) { @@ -92,7 +91,7 @@ __unused static NSString * NSStringFromASInterfaceState(ASInterfaceState interfa /// e.g. { +Visible, -Preload } (although that should never actually happen.) /// NOTE: Changes to MeasureLayout state don't really mean anything so we omit them for now. -__unused static NSString *NSStringFromASInterfaceStateChange(ASInterfaceState oldState, ASInterfaceState newState) +__unused AS_INLINE NSString *NSStringFromASInterfaceStateChange(ASInterfaceState oldState, ASInterfaceState newState) { if (oldState == newState) { return @"{ }"; @@ -111,22 +110,22 @@ __unused static NSString *NSStringFromASInterfaceStateChange(ASInterfaceState ol /** Returns the appropriate interface state for a given ASDisplayNode and window */ -extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) AS_WARN_UNUSED_RESULT; /** Given a layer, returns the associated display node, if any. */ -extern ASDisplayNode * _Nullable ASLayerToDisplayNode(CALayer * _Nullable layer) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASDisplayNode * _Nullable ASLayerToDisplayNode(CALayer * _Nullable layer) AS_WARN_UNUSED_RESULT; /** Given a view, returns the associated display node, if any. */ -extern ASDisplayNode * _Nullable ASViewToDisplayNode(UIView * _Nullable view) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASDisplayNode * _Nullable ASViewToDisplayNode(UIView * _Nullable view) AS_WARN_UNUSED_RESULT; /** Given a node, returns the root of the node hierarchy (where supernode == nil) */ -extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; /** If traverseSublayers == YES, this function will walk the layer hierarchy, spanning discontinuous sections of the node hierarchy\ @@ -134,39 +133,39 @@ extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_ 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 hierarchy to be created. */ -extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); /** This function will walk the node hierarchy in a breadth first fashion. It does run the block on the node provided directly to the function call. It does NOT traverse sublayers. */ -extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); /** Identical to ASDisplayNodePerformBlockOnEveryNode, except it does not run the block on the node provided directly to the function call - only on all descendants. */ -extern void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); /** Given a display node, traverses up the layer tree hierarchy, returning the first display node that passes block. */ -extern ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernode(ASDisplayNode * _Nullable node, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodes` property instead."); +AS_EXTERN ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernode(ASDisplayNode * _Nullable node, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use the `supernodes` property instead."); /** Given a display node, traverses up the layer tree hierarchy, returning the first display node of kind class. */ -extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodeOfClass:includingSelf:` method instead."); +AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use the `supernodeOfClass:includingSelf:` method instead."); /** * Given a layer, find the window it lives in, if any. */ -extern UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; +AS_EXTERN UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; /** * Given a layer, find the closest view it lives in, if any. */ -extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; +AS_EXTERN UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; /** * Given two nodes, finds their most immediate common parent. Used for geometry conversion methods. @@ -176,50 +175,48 @@ extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSE * 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 * _Nullable ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) AS_WARN_UNUSED_RESULT; +AS_EXTERN ASDisplayNode * _Nullable ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) AS_WARN_UNUSED_RESULT; /** Given a display node, collects all descendants. 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) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray *ASCollectDisplayNodes(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; /** 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)) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning all the display nodes of kind class. */ -extern NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning the depth-first display node, including the start node that pass the block. */ -extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstNode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; +AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstNode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning the depth-first display node, excluding the start node, that pass the block */ -extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; +AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; /** Given a display node, traverses down the node hierarchy, returning the depth-first display node of kind class. */ -extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; +AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; -extern UIColor *ASDisplayNodeDefaultPlaceholderColor(void) AS_WARN_UNUSED_RESULT; -extern UIColor *ASDisplayNodeDefaultTintColor(void) AS_WARN_UNUSED_RESULT; +AS_EXTERN UIColor *ASDisplayNodeDefaultPlaceholderColor(void) AS_WARN_UNUSED_RESULT; +AS_EXTERN UIColor *ASDisplayNodeDefaultTintColor(void) AS_WARN_UNUSED_RESULT; /** Disable willAppear / didAppear / didDisappear notifications for a sub-hierarchy, then re-enable when done. Nested calls are supported. */ -extern void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); -extern void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); +AS_EXTERN void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); +AS_EXTERN void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); // Not to be called directly. -extern void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode *object, ...); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode *object, ...); NS_ASSUME_NONNULL_END diff --git a/Source/ASDisplayNodeExtras.mm b/Source/ASDisplayNodeExtras.mm index 651a3424..2e87a04f 100644 --- a/Source/ASDisplayNodeExtras.mm +++ b/Source/ASDisplayNodeExtras.mm @@ -23,7 +23,7 @@ #import #import -extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) { +AS_EXTERN void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) { /** * UIKit components must be deallocated on the main thread. We use this shared * run loop queue to gradually deallocate them across many turns of the main run loop. @@ -48,7 +48,7 @@ extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull obj } } -extern void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...) +AS_EXTERN void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...) { NSString *owningClassName = NSStringFromClass(owningClass); NSArray *nameArray = [names componentsSeparatedByString:@", "]; @@ -66,7 +66,7 @@ extern void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull nam va_end(args); } -extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) +AS_EXTERN ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) { ASDisplayNodeCAssert(![displayNode isLayerBacked], @"displayNode must not be layer backed as it may have a nil window"); if (displayNode && [displayNode supportsRangeManagedInterfaceState]) { @@ -81,17 +81,17 @@ extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNod } } -extern ASDisplayNode *ASLayerToDisplayNode(CALayer *layer) +AS_EXTERN ASDisplayNode *ASLayerToDisplayNode(CALayer *layer) { return layer.asyncdisplaykit_node; } -extern ASDisplayNode *ASViewToDisplayNode(UIView *view) +AS_EXTERN ASDisplayNode *ASViewToDisplayNode(UIView *view) { return view.asyncdisplaykit_node; } -extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) +AS_EXTERN void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) { if (!node) { ASDisplayNodeCAssertNotNil(layer, @"Cannot recursively perform with nil node and nil layer"); @@ -119,7 +119,7 @@ extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDi } } -extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) +AS_EXTERN void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) { // Queue used to keep track of subnodes while traversing this layout in a BFS fashion. std::queue queue; @@ -138,7 +138,7 @@ extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^b } } -extern void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) +AS_EXTERN void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) { for (ASDisplayNode *subnode in node.subnodes) { ASDisplayNodePerformBlockOnEveryNode(nil, subnode, YES, block); @@ -176,7 +176,7 @@ static void _ASCollectDisplayNodes(NSMutableArray *array, CALayer *layer) _ASCollectDisplayNodes(array, sublayer); } -extern NSArray *ASCollectDisplayNodes(ASDisplayNode *node) +AS_EXTERN NSArray *ASCollectDisplayNodes(ASDisplayNode *node) { NSMutableArray *list = [[NSMutableArray alloc] init]; for (CALayer *sublayer in node.layer.sublayers) { @@ -201,14 +201,14 @@ static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode * } } -extern NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) +AS_EXTERN NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) { NSMutableArray *list = [[NSMutableArray alloc] init]; _ASDisplayNodeFindAllSubnodes(list, start, block); return list; } -extern NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) +AS_EXTERN NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) { return ASDisplayNodeFindAllSubnodes(start, ^(ASDisplayNode *n) { return [n isKindOfClass:c]; @@ -232,17 +232,17 @@ static ASDisplayNode *_ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL return nil; } -extern __kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) +AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) { return _ASDisplayNodeFindFirstNode(startNode, YES, block); } -extern __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) +AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) { return _ASDisplayNodeFindFirstNode(startNode, NO, block); } -extern __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) +AS_EXTERN __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) { return ASDisplayNodeFindFirstSubnode(start, ^(ASDisplayNode *n) { return [n isKindOfClass:c]; @@ -262,7 +262,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible return NO; } -extern UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) +AS_EXTERN UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) { UIView *view = ASFindClosestViewOfLayer(layer); if (UIWindow *window = ASDynamicCast(view, UIWindow)) { @@ -272,7 +272,7 @@ extern UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) } } -extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) +AS_EXTERN UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) { while (layer != nil) { if (UIView *view = ASDynamicCast(layer.delegate, UIView)) { @@ -283,7 +283,7 @@ extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) return nil; } -extern ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) +AS_EXTERN ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) { ASDisplayNode *possibleAncestor = node1; while (possibleAncestor) { @@ -297,7 +297,7 @@ extern ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node return possibleAncestor; } -extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) +AS_EXTERN ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) { // node <- supernode on each loop // previous <- node on each loop where node is not nil diff --git a/Source/ASExperimentalFeatures.h b/Source/ASExperimentalFeatures.h index 6b418d3b..570ed95f 100644 --- a/Source/ASExperimentalFeatures.h +++ b/Source/ASExperimentalFeatures.h @@ -14,7 +14,6 @@ #import NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** * A bit mask of features. Make sure to update configuration.json when you add entries. @@ -31,10 +30,9 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) { }; /// Convert flags -> name array. -NSArray *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags); +AS_EXTERN NSArray *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags); /// Convert name array -> flags. -ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray *array); +AS_EXTERN ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray *array); -ASDISPLAYNODE_EXTERN_C_END NS_ASSUME_NONNULL_END diff --git a/Source/ASImageNode.h b/Source/ASImageNode.h index a7c4c781..1a85dc71 100644 --- a/Source/ASImageNode.h +++ b/Source/ASImageNode.h @@ -189,13 +189,12 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image); @interface ASImageNode (Unavailable) -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE(); +- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE_MSG(); -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE(); +- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE_MSG(); @end -ASDISPLAYNODE_EXTERN_C_BEGIN /** * @abstract Image modification block that rounds (and optionally adds a border to) an image. @@ -207,7 +206,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN * * @return An ASImageNode image modification block. */ -asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor * _Nullable borderColor); +AS_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor * _Nullable borderColor); /** * @abstract Image modification block that applies a tint color à la UIImage configured with @@ -219,7 +218,6 @@ asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat * * @return An ASImageNode image modification block. */ -asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color); +AS_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color); -ASDISPLAYNODE_EXTERN_C_END NS_ASSUME_NONNULL_END diff --git a/Source/ASImageNode.mm b/Source/ASImageNode.mm index 7f2caeda..37a5777c 100644 --- a/Source/ASImageNode.mm +++ b/Source/ASImageNode.mm @@ -732,7 +732,7 @@ static ASDN::StaticMutex& cacheLock = *new ASDN::StaticMutex; #pragma mark - Extras -extern asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor) +AS_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor) { return ^(UIImage *originalImage) { ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); @@ -755,7 +755,7 @@ extern asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock( }; } -extern asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color) +AS_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color) { return ^(UIImage *originalImage) { ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); diff --git a/Source/ASLocking.h b/Source/ASLocking.h index 1e53a150..6f1ae103 100644 --- a/Source/ASLocking.h +++ b/Source/ASLocking.h @@ -80,7 +80,7 @@ typedef BOOL(^ASLockSequenceBlock)(NS_NOESCAPE ASAddLockBlock addLock); /** * Unlock and release all of the locks in this lock set. */ -NS_INLINE void ASUnlockSet(ASLockSet *lockSet) { +AS_INLINE void ASUnlockSet(ASLockSet *lockSet) { for (unsigned i = 0; i < lockSet->count; i++) { CFTypeRef lock = lockSet->locks[i]; [(__bridge id)lock unlock]; @@ -105,7 +105,7 @@ NS_INLINE void ASUnlockSet(ASLockSet *lockSet) { * one of the locks is already locked (recursive.) Only locks taken * inside this function are guaranteed not to cause a deadlock. */ -NS_INLINE ASLockSet ASLockSequence(NS_NOESCAPE ASLockSequenceBlock body) +AS_INLINE ASLockSet ASLockSequence(NS_NOESCAPE ASLockSequenceBlock body) { __block ASLockSet locks = (ASLockSet){0}; BOOL (^addLock)(id) = ^(id obj) { diff --git a/Source/ASMultiplexImageNode.h b/Source/ASMultiplexImageNode.h index 5cf12ac3..95785afe 100644 --- a/Source/ASMultiplexImageNode.h +++ b/Source/ASMultiplexImageNode.h @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN typedef id ASImageIdentifier; -extern NSString *const ASMultiplexImageNodeErrorDomain; +AS_EXTERN NSString *const ASMultiplexImageNodeErrorDomain; /** * ASMultiplexImageNode error codes. diff --git a/Source/ASNetworkImageNode.h b/Source/ASNetworkImageNode.h index 494925b8..6996d0fd 100644 --- a/Source/ASNetworkImageNode.h +++ b/Source/ASNetworkImageNode.h @@ -93,7 +93,7 @@ NS_ASSUME_NONNULL_BEGIN * @deprecated This API has been removed for now due to the increased complexity to the class that it brought. * Please use .URL instead. */ -@property (nullable, copy) NSArray *URLs ASDISPLAYNODE_DEPRECATED_MSG("Please use URL instead."); +@property (nullable, copy) NSArray *URLs AS_DEPRECATED_MSG("Please use URL instead."); /** * Download and display a new image. diff --git a/Source/ASNodeController+Beta.h b/Source/ASNodeController+Beta.h index a1411226..1887b1ce 100644 --- a/Source/ASNodeController+Beta.h +++ b/Source/ASNodeController+Beta.h @@ -31,20 +31,20 @@ - (void)loadNode; // for descriptions see definition -- (void)nodeDidLoad ASDISPLAYNODE_REQUIRES_SUPER; -- (void)nodeDidLayout ASDISPLAYNODE_REQUIRES_SUPER; +- (void)nodeDidLoad NS_REQUIRES_SUPER; +- (void)nodeDidLayout NS_REQUIRES_SUPER; -- (void)didEnterVisibleState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitVisibleState ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didEnterVisibleState NS_REQUIRES_SUPER; +- (void)didExitVisibleState NS_REQUIRES_SUPER; -- (void)didEnterDisplayState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitDisplayState ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didEnterDisplayState NS_REQUIRES_SUPER; +- (void)didExitDisplayState NS_REQUIRES_SUPER; -- (void)didEnterPreloadState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitPreloadState ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didEnterPreloadState NS_REQUIRES_SUPER; +- (void)didExitPreloadState NS_REQUIRES_SUPER; - (void)interfaceStateDidChange:(ASInterfaceState)newState - fromState:(ASInterfaceState)oldState ASDISPLAYNODE_REQUIRES_SUPER; + fromState:(ASInterfaceState)oldState NS_REQUIRES_SUPER; @end diff --git a/Source/ASTableNode.h b/Source/ASTableNode.h index d5a5ed67..f2b616ac 100644 --- a/Source/ASTableNode.h +++ b/Source/ASTableNode.h @@ -198,7 +198,7 @@ NS_ASSUME_NONNULL_BEGIN * 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:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; +- (void)performBatchAnimated:(BOOL)animated updates:(nullable void (NS_NOESCAPE ^)(void))updates completion:(nullable void (^)(BOOL finished))completion; /** * Perform a batch of updates asynchronously with animations in the batch. This method must be called from the main thread. @@ -209,7 +209,7 @@ NS_ASSUME_NONNULL_BEGIN * 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:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; +- (void)performBatchUpdates:(nullable void (NS_NOESCAPE ^)(void))updates completion:(nullable void (^)(BOOL finished))completion; /** * Returns YES if the ASCollectionNode is still processing changes from performBatchUpdates:. @@ -542,7 +542,7 @@ NS_ASSUME_NONNULL_BEGIN * @return a node for display at this indexpath. This will be called on the main thread and should not implement reuse (it will be called once per row). Unlike UITableView's version, this method * is not called when the row is about to display. */ -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); +- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASTableNode's method instead."); /** * Similar to -tableView:nodeForRowAtIndexPath: @@ -555,7 +555,7 @@ NS_ASSUME_NONNULL_BEGIN * Must be thread-safe (can be called on the main thread or a background * queue) and should not implement reuse (it will be called once per row). */ -- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); +- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASTableNode's method instead."); /** * Indicator to lock the data source for data fetching in async mode. @@ -565,7 +565,7 @@ NS_ASSUME_NONNULL_BEGIN * @param tableView The sender. * @deprecated The data source is always accessed on the main thread, and this method will not be called. */ -- (void)tableViewLockDataSource:(ASTableView *)tableView ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); +- (void)tableViewLockDataSource:(ASTableView *)tableView AS_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); /** * Indicator to unlock the data source for data fetching in asyn mode. @@ -575,7 +575,7 @@ NS_ASSUME_NONNULL_BEGIN * @param tableView The sender. * @deprecated The data source is always accessed on the main thread, and this method will not be called. */ -- (void)tableViewUnlockDataSource:(ASTableView *)tableView ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); +- (void)tableViewUnlockDataSource:(ASTableView *)tableView AS_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); @end @@ -660,7 +660,7 @@ NS_ASSUME_NONNULL_BEGIN * passed into this method may not correspond to the same item in your data source * if your data source has been updated since the last edit was processed. */ -- (void)tableView:(ASTableView *)tableView willDisplayNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); +- (void)tableView:(ASTableView *)tableView willDisplayNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASTableNode's method instead."); /** * Informs the delegate that the table view did remove the provided node from the view hierarchy. @@ -675,7 +675,7 @@ NS_ASSUME_NONNULL_BEGIN * passed into this method may not correspond to the same item in your data source * if your data source has been updated since the last edit was processed. */ -- (void)tableView:(ASTableView *)tableView didEndDisplayingNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); +- (void)tableView:(ASTableView *)tableView didEndDisplayingNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASTableNode's method instead."); /** * Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary. @@ -689,7 +689,7 @@ NS_ASSUME_NONNULL_BEGIN * ASTableView currently only supports batch events for tail loads. If you require a head load, consider implementing a * UIRefreshControl. */ -- (void)tableView:(ASTableView *)tableView willBeginBatchFetchWithContext:(ASBatchContext *)context ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); +- (void)tableView:(ASTableView *)tableView willBeginBatchFetchWithContext:(ASBatchContext *)context AS_DEPRECATED_MSG("Use ASTableNode's method instead."); /** * Tell the tableView if batch fetching should begin. @@ -702,7 +702,7 @@ NS_ASSUME_NONNULL_BEGIN * If not implemented, the tableView assumes that it should notify its asyncDelegate when batch fetching * should occur. */ -- (BOOL)shouldBatchFetchForTableView:(ASTableView *)tableView AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); +- (BOOL)shouldBatchFetchForTableView:(ASTableView *)tableView AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASTableNode's method instead."); /** * Provides the constrained size range for measuring the row at the index path. @@ -714,7 +714,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return A constrained size range for layout the node at this index path. */ -- (ASSizeRange)tableView:(ASTableView *)tableView constrainedSizeForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); +- (ASSizeRange)tableView:(ASTableView *)tableView constrainedSizeForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASTableNode's method instead."); /** * Informs the delegate that the table view will add the node @@ -729,13 +729,13 @@ NS_ASSUME_NONNULL_BEGIN * * This method is deprecated. Use @c tableView:willDisplayNode:forRowAtIndexPath: instead. */ -- (void)tableView:(ASTableView *)tableView willDisplayNodeForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); +- (void)tableView:(ASTableView *)tableView willDisplayNodeForRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASTableNode's method instead."); @end @interface ASTableNode (Deprecated) -- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("This method has been renamed to -waitUntilAllUpdatesAreProcessed."); +- (void)waitUntilAllUpdatesAreCommitted AS_DEPRECATED_MSG("This method has been renamed to -waitUntilAllUpdatesAreProcessed."); @end diff --git a/Source/ASTableView.h b/Source/ASTableView.h index f8762737..7ec1b3bf 100644 --- a/Source/ASTableView.h +++ b/Source/ASTableView.h @@ -47,8 +47,8 @@ NS_ASSUME_NONNULL_BEGIN @interface ASTableView (Deprecated) -@property (nonatomic, weak) id asyncDelegate ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's .delegate property instead."); -@property (nonatomic, weak) id asyncDataSource ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode .dataSource property instead."); +@property (nonatomic, weak) id asyncDelegate AS_DEPRECATED_MSG("Use ASTableNode's .delegate property instead."); +@property (nonatomic, weak) id asyncDataSource AS_DEPRECATED_MSG("Use ASTableNode .dataSource property instead."); /** * Initializer. @@ -58,24 +58,24 @@ NS_ASSUME_NONNULL_BEGIN * * @param style A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants. */ -- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style ASDISPLAYNODE_DEPRECATED_MSG("Please use ASTableNode instead of ASTableView."); +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style AS_DEPRECATED_MSG("Please use ASTableNode instead of ASTableView."); /** * The number of screens left to scroll before the delegate -tableView:beginBatchFetchingWithContext: is called. * * Defaults to two screenfuls. */ -@property (nonatomic) CGFloat leadingScreensForBatching ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +@property (nonatomic) CGFloat leadingScreensForBatching AS_DEPRECATED_MSG("Use ASTableNode property instead."); /** * The distance that the content view is inset from the table view edges. Defaults to UIEdgeInsetsZero. */ -@property (nonatomic) UIEdgeInsets contentInset ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead"); +@property (nonatomic) UIEdgeInsets contentInset AS_DEPRECATED_MSG("Use ASTableNode property instead"); /** * The offset of the content view's origin from the table node's origin. Defaults to CGPointZero. */ -@property (nonatomic) CGPoint contentOffset ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +@property (nonatomic) CGPoint contentOffset AS_DEPRECATED_MSG("Use ASTableNode property instead."); /** * YES to automatically adjust the contentOffset when cells are inserted or deleted above @@ -86,18 +86,18 @@ NS_ASSUME_NONNULL_BEGIN * * default is NO. */ -@property (nonatomic) BOOL automaticallyAdjustsContentOffset ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +@property (nonatomic) BOOL automaticallyAdjustsContentOffset AS_DEPRECATED_MSG("Use ASTableNode property instead."); /* * A Boolean value that determines whether the nodes that the data source renders will be flipped. */ -@property (nonatomic) BOOL inverted ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +@property (nonatomic) BOOL inverted AS_DEPRECATED_MSG("Use ASTableNode property instead."); -@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow AS_DEPRECATED_MSG("Use ASTableNode property instead."); -@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedRows AS_DEPRECATED_MSG("Use ASTableNode property instead."); -@property (nonatomic, readonly, nullable) NSArray *indexPathsForVisibleRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); +@property (nonatomic, readonly, nullable) NSArray *indexPathsForVisibleRows AS_DEPRECATED_MSG("Use ASTableNode property instead."); /** * Tuning parameters for a range type in full mode. @@ -109,7 +109,7 @@ NS_ASSUME_NONNULL_BEGIN * @see ASLayoutRangeMode * @see ASLayoutRangeType */ -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASTableNode method instead."); /** * Set the tuning parameters for a range type in full mode. @@ -120,7 +120,7 @@ NS_ASSUME_NONNULL_BEGIN * @see ASLayoutRangeMode * @see ASLayoutRangeType */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType AS_DEPRECATED_MSG("Use ASTableNode method instead."); /** * Tuning parameters for a range type in the specified mode. @@ -133,7 +133,7 @@ NS_ASSUME_NONNULL_BEGIN * @see ASLayoutRangeMode * @see ASLayoutRangeType */ -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASTableNode method instead."); /** * Set the tuning parameters for a range type in the specified mode. @@ -145,24 +145,24 @@ NS_ASSUME_NONNULL_BEGIN * @see ASLayoutRangeMode * @see ASLayoutRangeType */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (nullable NSArray *)indexPathsForRowsInRect:(CGRect)rect ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (nullable NSArray *)indexPathsForRowsInRect:(CGRect)rect AS_DEPRECATED_MSG("Use ASTableNode method instead."); /** * Similar to -visibleCells. * * @return an array containing the cell nodes being displayed on screen. */ -- (NSArray *)visibleNodes AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (NSArray *)visibleNodes AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASTableNode method instead."); /** * Similar to -indexPathForCell:. @@ -171,7 +171,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return an indexPath for this cellNode */ -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT AS_DEPRECATED_MSG("Use ASTableNode method instead."); /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -180,25 +180,25 @@ NS_ASSUME_NONNULL_BEGIN * the main thread. * @warning This method is substantially more expensive than UITableView's version. */ --(void)reloadDataWithCompletion:(void (^ _Nullable)(void))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +-(void)reloadDataWithCompletion:(void (^ _Nullable)(void))completion AS_DEPRECATED_MSG("Use ASTableNode method instead."); /** * Reload everything from scratch, destroying the working range and all cached nodes. * * @warning This method is substantially more expensive than UITableView's version. */ -- (void)reloadData ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)reloadData AS_DEPRECATED_MSG("Use ASTableNode method instead."); /** * Triggers a relayout of all nodes. * * @discussion This method invalidates and lays out every cell node in the table view. */ -- (void)relayoutItems ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)relayoutItems AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)beginUpdates ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); +- (void)beginUpdates AS_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); -- (void)endUpdates ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); +- (void)endUpdates AS_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); /** * Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view. @@ -213,40 +213,40 @@ NS_ASSUME_NONNULL_BEGIN * 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 (^ _Nullable)(BOOL completed))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); +- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^ _Nullable)(BOOL completed))completion AS_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); /** * See ASTableNode.h for full documentation of these methods. */ @property (nonatomic, readonly) BOOL isProcessingUpdates; - (void)onDidFinishProcessingUpdates:(void (^)(void))completion; -- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("Use -[ASTableNode waitUntilAllUpdatesAreProcessed] instead."); +- (void)waitUntilAllUpdatesAreCommitted AS_DEPRECATED_MSG("Use -[ASTableNode waitUntilAllUpdatesAreProcessed] instead."); -- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath AS_DEPRECATED_MSG("Use ASTableNode method instead."); -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated AS_DEPRECATED_MSG("Use ASTableNode method instead."); @end -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASTableDataSource.") +AS_DEPRECATED_MSG("Renamed to ASTableDataSource.") @protocol ASTableViewDataSource @end -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASTableDelegate.") +AS_DEPRECATED_MSG("Renamed to ASTableDelegate.") @protocol ASTableViewDelegate @end diff --git a/Source/ASTableViewProtocols.h b/Source/ASTableViewProtocols.h index 08c54d04..89b9fb91 100644 --- a/Source/ASTableViewProtocols.h +++ b/Source/ASTableViewProtocols.h @@ -28,9 +28,9 @@ NS_ASSUME_NONNULL_BEGIN @optional -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:numberOfRowsInSection: instead."); +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section AS_DEPRECATED_MSG("Implement -tableNode:numberOfRowsInSection: instead."); -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView ASDISPLAYNODE_DEPRECATED_MSG("Implement numberOfSectionsInTableNode: instead."); +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView AS_DEPRECATED_MSG("Implement numberOfSectionsInTableNode: instead."); - (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; - (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section; @@ -71,14 +71,14 @@ NS_ASSUME_NONNULL_BEGIN - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath; -- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:shouldHighlightRowAtIndexPath: instead."); -- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:didHighlightRowAtIndexPath: instead."); -- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:didUnhighlightRowAtIndexPath: instead."); +- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -tableNode:shouldHighlightRowAtIndexPath: instead."); +- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -tableNode:didHighlightRowAtIndexPath: instead."); +- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -tableNode:didUnhighlightRowAtIndexPath: instead."); -- (nullable NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:willSelectRowAtIndexPath: instead."); -- (nullable NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:willDeselectRowAtIndexPath: instead."); -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:didSelectRowAtIndexPath: instead."); -- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:didDeselectRowAtIndexPath: instead."); +- (nullable NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -tableNode:willSelectRowAtIndexPath: instead."); +- (nullable NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -tableNode:willDeselectRowAtIndexPath: instead."); +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -tableNode:didSelectRowAtIndexPath: instead."); +- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -tableNode:didDeselectRowAtIndexPath: instead."); - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; - (nullable NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath; @@ -94,9 +94,9 @@ NS_ASSUME_NONNULL_BEGIN - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath; -- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:shouldShowMenuForRowAtIndexPath: instead."); -- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:canPerformAction:forRowAtIndexPath:withSender: instead."); -- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:performAction:forRowAtIndexPath:withSender: instead."); +- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath AS_DEPRECATED_MSG("Implement -tableNode:shouldShowMenuForRowAtIndexPath: instead."); +- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender AS_DEPRECATED_MSG("Implement -tableNode:canPerformAction:forRowAtIndexPath:withSender: instead."); +- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender AS_DEPRECATED_MSG("Implement -tableNode:performAction:forRowAtIndexPath:withSender: instead."); @end diff --git a/Source/ASTextNode.h b/Source/ASTextNode.h index d1d1c734..9e2e84b9 100644 --- a/Source/ASTextNode.h +++ b/Source/ASTextNode.h @@ -236,7 +236,7 @@ NS_ASSUME_NONNULL_BEGIN @see attributedText */ -@property (nullable, copy) NSAttributedString *attributedString ASDISPLAYNODE_DEPRECATED_MSG("Use .attributedText instead."); +@property (nullable, copy) NSAttributedString *attributedString AS_DEPRECATED_MSG("Use .attributedText instead."); /** @@ -245,7 +245,7 @@ NS_ASSUME_NONNULL_BEGIN @see truncationAttributedText */ -@property (nullable, copy) NSAttributedString *truncationAttributedString ASDISPLAYNODE_DEPRECATED_MSG("Use .truncationAttributedText instead."); +@property (nullable, copy) NSAttributedString *truncationAttributedString AS_DEPRECATED_MSG("Use .truncationAttributedText instead."); @end diff --git a/Source/ASViewController.h b/Source/ASViewController.h index b04137cc..f576724e 100644 --- a/Source/ASViewController.h +++ b/Source/ASViewController.h @@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Set this block to customize the ASDisplayTraits returned when the VC transitions to the given window size. */ -@property (nonatomic, copy) ASDisplayTraitsForTraitWindowSizeBlock overrideDisplayTraitsWithWindowSize ASDISPLAYNODE_DEPRECATED_MSG("This property is actually never accessed inside the framework"); +@property (nonatomic, copy) ASDisplayTraitsForTraitWindowSizeBlock overrideDisplayTraitsWithWindowSize AS_DEPRECATED_MSG("This property is actually never accessed inside the framework"); /** * @abstract Passthrough property to the the .interfaceState of the node. diff --git a/Source/ASVisibilityProtocols.h b/Source/ASVisibilityProtocols.h index 67ee0ab0..7f94bf6a 100644 --- a/Source/ASVisibilityProtocols.h +++ b/Source/ASVisibilityProtocols.h @@ -22,11 +22,7 @@ NS_ASSUME_NONNULL_BEGIN @class UIViewController; -ASDISPLAYNODE_EXTERN_C_BEGIN - -extern ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth); /** * ASVisibilityDepth diff --git a/Source/Base/ASAssert.h b/Source/Base/ASAssert.h index 636ef45f..4a87c021 100644 --- a/Source/Base/ASAssert.h +++ b/Source/Base/ASAssert.h @@ -81,13 +81,11 @@ */ #pragma mark - Main Thread Assertions Disabling -ASDISPLAYNODE_EXTERN_C_BEGIN -BOOL ASMainThreadAssertionsAreDisabled(void); +AS_EXTERN BOOL ASMainThreadAssertionsAreDisabled(void); -void ASPushMainThreadAssertionsDisabled(void); +AS_EXTERN void ASPushMainThreadAssertionsDisabled(void); -void ASPopMainThreadAssertionsDisabled(void); -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASPopMainThreadAssertionsDisabled(void); #pragma mark - Non-Fatal Assertions diff --git a/Source/Base/ASBaseDefines.h b/Source/Base/ASBaseDefines.h index b274aefa..05521059 100755 --- a/Source/Base/ASBaseDefines.h +++ b/Source/Base/ASBaseDefines.h @@ -15,96 +15,23 @@ // http://www.apache.org/licenses/LICENSE-2.0 // -// The C++ compiler mangles C function names. extern "C" { /* your C functions */ } prevents this. -// You should wrap all C function prototypes declared in headers with ASDISPLAYNODE_EXTERN_C_BEGIN/END, even if -// they are included only from .m (Objective-C) files. It's common for .m files to start using C++ -// features and become .mm (Objective-C++) files. Always wrapping the prototypes with -// ASDISPLAYNODE_EXTERN_C_BEGIN/END will save someone a headache once they need to do this. You do not need to -// wrap constants, only C functions. See StackOverflow for more details: -// http://stackoverflow.com/questions/1041866/in-c-source-what-is-the-effect-of-extern-c -#ifdef __cplusplus -# define ASDISPLAYNODE_EXTERN_C_BEGIN extern "C" { -# define ASDISPLAYNODE_EXTERN_C_END } -#else -# define ASDISPLAYNODE_EXTERN_C_BEGIN -# define ASDISPLAYNODE_EXTERN_C_END -#endif +#import +#import +#import -#ifdef __GNUC__ -# define ASDISPLAYNODE_GNUC(major, minor) \ -(__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) -#else -# define ASDISPLAYNODE_GNUC(major, minor) 0 -#endif - -#ifndef ASDISPLAYNODE_INLINE -# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -# define ASDISPLAYNODE_INLINE static inline -# elif defined (__MWERKS__) || defined (__cplusplus) -# define ASDISPLAYNODE_INLINE static inline -# elif ASDISPLAYNODE_GNUC (3, 0) -# define ASDISPLAYNODE_INLINE static __inline__ __attribute__ ((always_inline)) -# else -# define ASDISPLAYNODE_INLINE static -# endif -#endif - -#ifndef ASDISPLAYNODE_HIDDEN -# if ASDISPLAYNODE_GNUC (4,0) -# define ASDISPLAYNODE_HIDDEN __attribute__ ((visibility ("hidden"))) -# else -# define ASDISPLAYNODE_HIDDEN /* no hidden */ -# endif -#endif - -#ifndef ASDISPLAYNODE_PURE -# if ASDISPLAYNODE_GNUC (3, 0) -# define ASDISPLAYNODE_PURE __attribute__ ((pure)) -# else -# define ASDISPLAYNODE_PURE /* no pure */ -# endif -#endif - -#ifndef ASDISPLAYNODE_CONST -# if ASDISPLAYNODE_GNUC (3, 0) -# define ASDISPLAYNODE_CONST __attribute__ ((const)) -# else -# define ASDISPLAYNODE_CONST /* no const */ -# endif -#endif - -#ifndef ASDISPLAYNODE_WARN_UNUSED -# if ASDISPLAYNODE_GNUC (3, 4) -# define ASDISPLAYNODE_WARN_UNUSED __attribute__ ((warn_unused_result)) -# else -# define ASDISPLAYNODE_WARN_UNUSED /* no warn_unused */ -# endif -#endif +#define AS_EXTERN FOUNDATION_EXTERN +#define AS_INLINE NS_INLINE #ifndef ASDISPLAYNODE_WARN_DEPRECATED # define ASDISPLAYNODE_WARN_DEPRECATED 1 #endif -#ifndef ASDISPLAYNODE_DEPRECATED -# if ASDISPLAYNODE_GNUC (3, 0) && ASDISPLAYNODE_WARN_DEPRECATED -# define ASDISPLAYNODE_DEPRECATED __attribute__ ((deprecated)) -# else -# define ASDISPLAYNODE_DEPRECATED -# endif -#endif - -#ifndef ASDISPLAYNODE_DEPRECATED_MSG -# if ASDISPLAYNODE_GNUC (3, 0) && ASDISPLAYNODE_WARN_DEPRECATED -# define ASDISPLAYNODE_DEPRECATED_MSG(msg) __deprecated_msg(msg) -# else -# define ASDISPLAYNODE_DEPRECATED_MSG(msg) -# endif -#endif - -#if defined (__cplusplus) && defined (__GNUC__) -# define ASDISPLAYNODE_NOTHROW __attribute__ ((nothrow)) +#if ASDISPLAYNODE_WARN_DEPRECATED +# define AS_DEPRECATED DEPRECATED_ATTRIBUTE +# define AS_DEPRECATED_MSG(msg) DEPRECATED_MSG_ATTRIBUTE(msg) #else -# define ASDISPLAYNODE_NOTHROW +# define AS_DEPRECATED +# define AS_DEPRECATED_MSG(msg) #endif #ifndef AS_ENABLE_TIPS @@ -122,87 +49,22 @@ # define AS_SAVE_EVENT_BACKTRACES 0 #endif -#define ARRAY_COUNT(x) sizeof(x) / sizeof(x[0]) - -#ifndef __has_feature // Optional. -#define __has_feature(x) 0 // Compatibility with non-clang compilers. -#endif - -#ifndef __has_attribute // Optional. -#define __has_attribute(x) 0 // Compatibility with non-clang compilers. -#endif - -#ifndef NS_CONSUMED -#if __has_feature(attribute_ns_consumed) -#define NS_CONSUMED __attribute__((ns_consumed)) -#else -#define NS_CONSUMED -#endif -#endif - -#ifndef NS_RETURNS_RETAINED -#if __has_feature(attribute_ns_returns_retained) -#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) -#else -#define NS_RETURNS_RETAINED -#endif -#endif - -#ifndef CF_RETURNS_RETAINED -#if __has_feature(attribute_cf_returns_retained) -#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) -#else -#define CF_RETURNS_RETAINED -#endif -#endif - -#ifndef ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER -#define ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER() \ - do { \ - NSAssert2(NO, @"%@ is not the designated initializer for instances of %@.", NSStringFromSelector(_cmd), NSStringFromClass([self class])); \ - return nil; \ - } while (0) -#endif // ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER - -// It's hard to pass quoted strings via xcodebuild preprocessor define arguments, so we'll convert -// the preprocessor values to strings here. -// -// It takes two steps to do this in gcc as per -// http://gcc.gnu.org/onlinedocs/cpp/Stringification.html -#define ASDISPLAYNODE_TO_STRING(str) #str -#define ASDISPLAYNODE_TO_UNICODE_STRING(str) @ASDISPLAYNODE_TO_STRING(str) - -#ifndef ASDISPLAYNODE_REQUIRES_SUPER -#if __has_attribute(objc_requires_super) -#define ASDISPLAYNODE_REQUIRES_SUPER __attribute__((objc_requires_super)) -#else -#define ASDISPLAYNODE_REQUIRES_SUPER -#endif -#endif - -#ifndef AS_UNAVAILABLE #if __has_attribute(unavailable) -#define AS_UNAVAILABLE(message) __attribute__((unavailable(message))) +# define AS_UNAVAILABLE_MSG(message) __attribute__((unavailable(message))) #else -#define AS_UNAVAILABLE(message) -#endif +# define AS_UNAVAILABLE_MSG(message) #endif -#ifndef AS_WARN_UNUSED_RESULT #if __has_attribute(warn_unused_result) -#define AS_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +# define AS_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #else -#define AS_WARN_UNUSED_RESULT -#endif +# define AS_WARN_UNUSED_RESULT #endif -#define ASOVERLOADABLE __attribute__((overloadable)) - - -#if __has_attribute(noescape) -#define AS_NOESCAPE __attribute__((noescape)) +#if __has_attribute(overloadable) +# define AS_OVERLOADABLE __attribute__((overloadable)) #else -#define AS_NOESCAPE +# define AS_OVERLOADABLE #endif #if __has_attribute(objc_subclassing_restricted) diff --git a/Source/Base/ASEqualityHelpers.h b/Source/Base/ASEqualityHelpers.h index 9bdfb2ed..28824b45 100644 --- a/Source/Base/ASEqualityHelpers.h +++ b/Source/Base/ASEqualityHelpers.h @@ -23,7 +23,7 @@ @param otherObj The second object in the comparison. Can be nil. @result YES if the objects are equal, including cases where both object are nil. */ -ASDISPLAYNODE_INLINE BOOL ASObjectIsEqual(id obj, id otherObj) +AS_INLINE BOOL ASObjectIsEqual(id obj, id otherObj) { return obj == otherObj || [obj isEqual:otherObj]; } diff --git a/Source/Base/ASLog.h b/Source/Base/ASLog.h index e8740463..99da08cc 100644 --- a/Source/Base/ASLog.h +++ b/Source/Base/ASLog.h @@ -25,8 +25,6 @@ #define ASEnableVerboseLogging 0 #endif -ASDISPLAYNODE_EXTERN_C_BEGIN - /** * Disable all logging. * @@ -40,7 +38,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN * are at the `debug` log level, which the system * disables in production. */ -void ASDisableLogging(void); +AS_EXTERN void ASDisableLogging(void); /** * Restore logging that has been runtime-disabled via ASDisableLogging(). @@ -50,33 +48,31 @@ void ASDisableLogging(void); * configuration. This can be used in conjunction with ASDisableLogging() * to allow logging to be toggled off and back on at runtime. */ -void ASEnableLogging(void); +AS_EXTERN void ASEnableLogging(void); /// Log for general node events e.g. interfaceState, didLoad. #define ASNodeLogEnabled 1 -os_log_t ASNodeLog(void); +AS_EXTERN os_log_t ASNodeLog(void); /// Log for layout-specific events e.g. calculateLayout. #define ASLayoutLogEnabled 1 -os_log_t ASLayoutLog(void); +AS_EXTERN os_log_t ASLayoutLog(void); /// Log for display-specific events e.g. display queue batches. #define ASDisplayLogEnabled 1 -os_log_t ASDisplayLog(void); +AS_EXTERN os_log_t ASDisplayLog(void); /// Log for collection events e.g. reloadData, performBatchUpdates. #define ASCollectionLogEnabled 1 -os_log_t ASCollectionLog(void); +AS_EXTERN os_log_t ASCollectionLog(void); /// Log for ASNetworkImageNode and ASMultiplexImageNode events. #define ASImageLoadingLogEnabled 1 -os_log_t ASImageLoadingLog(void); +AS_EXTERN os_log_t ASImageLoadingLog(void); /// Specialized log for our main thread deallocation trampoline. #define ASMainThreadDeallocationLogEnabled 0 -os_log_t ASMainThreadDeallocationLog(void); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN os_log_t ASMainThreadDeallocationLog(void); /** * The activity tracing system changed a lot between iOS 9 and 10. diff --git a/Source/Base/ASLog.m b/Source/Base/ASLog.m index e1c42ea7..1303dd00 100644 --- a/Source/Base/ASLog.m +++ b/Source/Base/ASLog.m @@ -23,7 +23,7 @@ void ASEnableLogging() { atomic_store(&__ASLogEnabled, YES); } -ASDISPLAYNODE_INLINE BOOL ASLoggingIsEnabled() { +AS_INLINE BOOL ASLoggingIsEnabled() { return atomic_load(&__ASLogEnabled); } diff --git a/Source/Details/ASAbstractLayoutController.h b/Source/Details/ASAbstractLayoutController.h index c59e1a4e..c5ffc740 100644 --- a/Source/Details/ASAbstractLayoutController.h +++ b/Source/Details/ASAbstractLayoutController.h @@ -20,15 +20,11 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); -FOUNDATION_EXPORT ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); +AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); -FOUNDATION_EXPORT ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); - -FOUNDATION_EXPORT CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection); @interface ASAbstractLayoutController : NSObject diff --git a/Source/Details/ASAbstractLayoutController.mm b/Source/Details/ASAbstractLayoutController.mm index 4681206d..f724a242 100644 --- a/Source/Details/ASAbstractLayoutController.mm +++ b/Source/Details/ASAbstractLayoutController.mm @@ -21,14 +21,14 @@ #include -extern ASRangeTuningParameters const ASRangeTuningParametersZero = {}; +AS_EXTERN ASRangeTuningParameters const ASRangeTuningParametersZero = {}; -extern BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs) +AS_EXTERN BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs) { return lhs.leadingBufferScreenfuls == rhs.leadingBufferScreenfuls && lhs.trailingBufferScreenfuls == rhs.trailingBufferScreenfuls; } -extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, +AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters) { ASDirectionalScreenfulBuffer horizontalBuffer = {0, 0}; @@ -41,7 +41,7 @@ extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScr return horizontalBuffer; } -extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, +AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters) { ASDirectionalScreenfulBuffer verticalBuffer = {0, 0}; @@ -54,7 +54,7 @@ extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrol return verticalBuffer; } -extern CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer) +AS_EXTERN CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer) { CGFloat negativeDirectionWidth = buffer.negativeDirection * rect.size.width; CGFloat positiveDirectionWidth = buffer.positiveDirection * rect.size.width; @@ -63,7 +63,7 @@ extern CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer return rect; } -extern CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer) +AS_EXTERN CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer) { CGFloat negativeDirectionHeight = buffer.negativeDirection * rect.size.height; CGFloat positiveDirectionHeight = buffer.positiveDirection * rect.size.height; @@ -72,7 +72,7 @@ extern CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer b return rect; } -extern CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, +AS_EXTERN CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection) { // Can scroll horizontally - expand the range appropriately diff --git a/Source/Details/ASCollectionViewLayoutInspector.h b/Source/Details/ASCollectionViewLayoutInspector.h index ba2aadf2..229b2f42 100644 --- a/Source/Details/ASCollectionViewLayoutInspector.h +++ b/Source/Details/ASCollectionViewLayoutInspector.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN -extern ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionView); +AS_EXTERN ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionView); @protocol ASCollectionViewLayoutInspecting @@ -73,7 +73,7 @@ extern ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *colle * @deprecated This method will not be called, and it is only deprecated as a reminder to remove it. * Supplementary elements must exist in the same sections as regular collection view items i.e. -numberOfSectionsInCollectionView: */ -- (NSUInteger)collectionView:(ASCollectionView *)collectionView numberOfSectionsForSupplementaryNodeOfKind:(NSString *)kind ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); +- (NSUInteger)collectionView:(ASCollectionView *)collectionView numberOfSectionsForSupplementaryNodeOfKind:(NSString *)kind AS_DEPRECATED_MSG("Use ASCollectionNode's method instead."); @end diff --git a/Source/Details/ASDataController.h b/Source/Details/ASDataController.h index 9407cda6..7bb5e75e 100644 --- a/Source/Details/ASDataController.h +++ b/Source/Details/ASDataController.h @@ -47,8 +47,8 @@ NS_ASSUME_NONNULL_BEGIN typedef NSUInteger ASDataControllerAnimationOptions; -extern NSString * const ASDataControllerRowNodeKind; -extern NSString * const ASCollectionInvalidUpdateException; +AS_EXTERN NSString * const ASDataControllerRowNodeKind; +AS_EXTERN NSString * const ASCollectionInvalidUpdateException; /** Data source for data controller diff --git a/Source/Details/ASGraphicsContext.h b/Source/Details/ASGraphicsContext.h index 0713f104..336ebbc4 100644 --- a/Source/Details/ASGraphicsContext.h +++ b/Source/Details/ASGraphicsContext.h @@ -29,28 +29,26 @@ */ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** * Creates a one-shot context. * * Behavior is the same as UIGraphicsBeginImageContextWithOptions. */ -extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); +AS_EXTERN void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); /** * Generates and image and ends the current one-shot context. * * Behavior is the same as UIGraphicsGetImageFromCurrentImageContext followed by UIGraphicsEndImageContext. */ -extern UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext(void) NS_RETURNS_RETAINED; +AS_EXTERN UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext(void) NS_RETURNS_RETAINED; /** * Call this if you want to end the current context without making an image. * * Behavior is the same as UIGraphicsEndImageContext. */ -extern void ASGraphicsEndImageContext(void); +AS_EXTERN void ASGraphicsEndImageContext(void); -ASDISPLAYNODE_EXTERN_C_END NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASGraphicsContext.m b/Source/Details/ASGraphicsContext.m index 37810a10..d1dd61cc 100644 --- a/Source/Details/ASGraphicsContext.m +++ b/Source/Details/ASGraphicsContext.m @@ -41,7 +41,7 @@ static UInt8 __contextDataAssociationKey; #pragma mark - Graphics Contexts -extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) +AS_EXTERN void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIGraphicsBeginImageContextWithOptions(size, opaque, scale); @@ -106,7 +106,7 @@ extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGF CGContextRelease(context); } -extern UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_RETAINED +AS_EXTERN UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_RETAINED { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); @@ -160,7 +160,7 @@ extern UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_R return result; } -extern void ASGraphicsEndImageContext() +AS_EXTERN void ASGraphicsEndImageContext() { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { UIGraphicsEndImageContext(); diff --git a/Source/Details/ASHashing.h b/Source/Details/ASHashing.h index 0fc8d72f..6177a74f 100644 --- a/Source/Details/ASHashing.h +++ b/Source/Details/ASHashing.h @@ -14,7 +14,6 @@ #import NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** * When std::hash is unavailable, this function will hash a bucket o' bits real fast. @@ -40,7 +39,6 @@ ASDISPLAYNODE_EXTERN_C_BEGIN * use `pragma clang diagnostic warning "-Wpadded"` around your struct definition * or manually initialize the fields of your struct (`myStruct.x = 7;` etc). */ -NSUInteger ASHashBytes(void *bytes, size_t length); +AS_EXTERN NSUInteger ASHashBytes(void *bytes, size_t length); -ASDISPLAYNODE_EXTERN_C_END NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASLayoutController.h b/Source/Details/ASLayoutController.h index dacaf09c..3e8aa6dc 100644 --- a/Source/Details/ASLayoutController.h +++ b/Source/Details/ASLayoutController.h @@ -25,16 +25,12 @@ NS_ASSUME_NONNULL_BEGIN @class ASCollectionElement, ASElementMap; -ASDISPLAYNODE_EXTERN_C_BEGIN - struct ASDirectionalScreenfulBuffer { CGFloat positiveDirection; // Positive relative to iOS Core Animation layer coordinate space. CGFloat negativeDirection; }; typedef struct ASDirectionalScreenfulBuffer ASDirectionalScreenfulBuffer; -ASDISPLAYNODE_EXTERN_C_END - @protocol ASLayoutController - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; diff --git a/Source/Details/ASObjectDescriptionHelpers.h b/Source/Details/ASObjectDescriptionHelpers.h index c4ae0ec3..c3eb7053 100644 --- a/Source/Details/ASObjectDescriptionHelpers.h +++ b/Source/Details/ASObjectDescriptionHelpers.h @@ -52,15 +52,13 @@ NS_ASSUME_NONNULL_BEGIN - (NSMutableArray *)propertiesForDescription; @end -ASDISPLAYNODE_EXTERN_C_BEGIN - -NSString *ASGetDescriptionValueString(id object); +AS_EXTERN NSString *ASGetDescriptionValueString(id object); /// Useful for structs etc. Returns e.g. { position = (0 0); frame = (0 0; 50 50) } -NSString *ASObjectDescriptionMakeWithoutObject(NSArray * _Nullable propertyGroups); +AS_EXTERN NSString *ASObjectDescriptionMakeWithoutObject(NSArray * _Nullable propertyGroups); /// Returns e.g. -NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray * _Nullable propertyGroups); +AS_EXTERN NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray * _Nullable propertyGroups); /** * Returns e.g. @@ -68,10 +66,8 @@ NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray -extern ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) +AS_EXTERN ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) { // Add 1 to the end result because 0 is not accepted by NSArray and NSMapTable. // To avoid overflow after adding, x and y can't be UINT16_MAX (0xFFFF) **at the same time**. @@ -22,29 +22,29 @@ extern ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) return (x << 16) + y + 1; } -extern ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) +AS_EXTERN ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) { return ASPageCoordinateMake((MAX(0.0, point.x) / pageSize.width), (MAX(0.0, point.y) / pageSize.height)); } -extern uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) +AS_EXTERN uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) { return (pageCoordinate - 1) >> 16; } -extern uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) +AS_EXTERN uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) { return (pageCoordinate - 1) & ~(0xFFFF<<16); } -extern CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) +AS_EXTERN CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) { CGFloat pageWidth = pageSize.width; CGFloat pageHeight = pageSize.height; return CGRectMake(ASPageCoordinateGetX(pageCoordinate) * pageWidth, ASPageCoordinateGetY(pageCoordinate) * pageHeight, pageWidth, pageHeight); } -extern NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) +AS_EXTERN NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) { CGRect contentRect = CGRectMake(0.0, 0.0, contentSize.width, contentSize.height); // Make sure the specified rect is within contentRect diff --git a/Source/Details/ASPhotosFrameworkImageRequest.h b/Source/Details/ASPhotosFrameworkImageRequest.h index c85cf32e..1a56329b 100644 --- a/Source/Details/ASPhotosFrameworkImageRequest.h +++ b/Source/Details/ASPhotosFrameworkImageRequest.h @@ -17,15 +17,17 @@ #import #import +#import NS_ASSUME_NONNULL_BEGIN -extern NSString *const ASPhotosURLScheme; +AS_EXTERN NSString *const ASPhotosURLScheme; /** @abstract Use ASPhotosFrameworkImageRequest to encapsulate all the information needed to request an image from the Photos framework and store it in a URL. */ +AS_SUBCLASSING_RESTRICTED API_AVAILABLE(ios(8.0), tvos(10.0)) @interface ASPhotosFrameworkImageRequest : NSObject @@ -66,6 +68,9 @@ API_AVAILABLE(ios(8.0), tvos(10.0)) */ @property (nonatomic, readonly) NSURL *url; +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + @end NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASPhotosFrameworkImageRequest.m b/Source/Details/ASPhotosFrameworkImageRequest.m index 31bbadae..14028ccb 100644 --- a/Source/Details/ASPhotosFrameworkImageRequest.m +++ b/Source/Details/ASPhotosFrameworkImageRequest.m @@ -45,13 +45,6 @@ static NSString *const _ASPhotosURLQueryKeyCropHeight = @"crop_h"; @implementation ASPhotosFrameworkImageRequest -- (instancetype)init -{ - ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER(); - self = [self initWithAssetIdentifier:@""]; - return nil; -} - - (instancetype)initWithAssetIdentifier:(NSString *)assetIdentifier { self = [super init]; diff --git a/Source/Details/ASRecursiveUnfairLock.h b/Source/Details/ASRecursiveUnfairLock.h index fff42b59..af1527d5 100644 --- a/Source/Details/ASRecursiveUnfairLock.h +++ b/Source/Details/ASRecursiveUnfairLock.h @@ -13,6 +13,7 @@ #import #import #import +#import // Don't import C-only header if we're in a C++ file #ifndef __cplusplus @@ -32,18 +33,16 @@ typedef struct { int _count; // Protected by lock } ASRecursiveUnfairLock; -CF_EXTERN_C_BEGIN - /** * Lock, blocking if needed. */ -OS_UNFAIR_LOCK_AVAILABILITY +AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY void ASRecursiveUnfairLockLock(ASRecursiveUnfairLock *l); /** * Try to lock without blocking. Returns whether we took the lock. */ -OS_UNFAIR_LOCK_AVAILABILITY +AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l); /** @@ -51,9 +50,7 @@ BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l); * the lock will result in an assertion failure, and undefined * behavior if foundation assertions are disabled. */ -OS_UNFAIR_LOCK_AVAILABILITY +AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY void ASRecursiveUnfairLockUnlock(ASRecursiveUnfairLock *l); -CF_EXTERN_C_END - NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASScrollDirection.h b/Source/Details/ASScrollDirection.h index 373e22f9..6a89b6f0 100644 --- a/Source/Details/ASScrollDirection.h +++ b/Source/Details/ASScrollDirection.h @@ -30,20 +30,16 @@ typedef NS_OPTIONS(NSInteger, ASScrollDirection) { ASScrollDirectionDown = 1 << 3 }; -extern const ASScrollDirection ASScrollDirectionHorizontalDirections; -extern const ASScrollDirection ASScrollDirectionVerticalDirections; +AS_EXTERN const ASScrollDirection ASScrollDirectionHorizontalDirections; +AS_EXTERN const ASScrollDirection ASScrollDirectionVerticalDirections; -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN BOOL ASScrollDirectionContainsVerticalDirection(ASScrollDirection scrollDirection); +AS_EXTERN BOOL ASScrollDirectionContainsHorizontalDirection(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsVerticalDirection(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsHorizontalDirection(ASScrollDirection scrollDirection); - -BOOL ASScrollDirectionContainsRight(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsLeft(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection); -BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection); -ASScrollDirection ASScrollDirectionApplyTransform(ASScrollDirection scrollDirection, CGAffineTransform transform); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN BOOL ASScrollDirectionContainsRight(ASScrollDirection scrollDirection); +AS_EXTERN BOOL ASScrollDirectionContainsLeft(ASScrollDirection scrollDirection); +AS_EXTERN BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection); +AS_EXTERN BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection); +AS_EXTERN ASScrollDirection ASScrollDirectionApplyTransform(ASScrollDirection scrollDirection, CGAffineTransform transform); NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASThread.h b/Source/Details/ASThread.h index b650fec1..439bfb1c 100644 --- a/Source/Details/ASThread.h +++ b/Source/Details/ASThread.h @@ -29,7 +29,7 @@ #import #import -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASDisplayNodeThreadIsMain() +AS_INLINE AS_WARN_UNUSED_RESULT BOOL ASDisplayNodeThreadIsMain() { return 0 != pthread_main_np(); } @@ -52,11 +52,11 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASDisplayNodeThreadIsMain() __unsafe_unretained id __lockToken __attribute__((cleanup(_ASLockScopeUnownedCleanup))) = nsLocking; \ [__lockToken lock]; -ASDISPLAYNODE_INLINE void _ASLockScopeCleanup(id __strong * const lockPtr) { +AS_INLINE void _ASLockScopeCleanup(id __strong * const lockPtr) { [*lockPtr unlock]; } -ASDISPLAYNODE_INLINE void _ASLockScopeUnownedCleanup(id __unsafe_unretained * const lockPtr) { +AS_INLINE void _ASLockScopeUnownedCleanup(id __unsafe_unretained * const lockPtr) { [*lockPtr unlock]; } @@ -97,7 +97,7 @@ ASDISPLAYNODE_INLINE void _ASLockScopeUnownedCleanup(id __unsafe_unre - (void)unlock { [object unlock]; } \ - (BOOL)tryLock { return [object tryLock]; } -ASDISPLAYNODE_INLINE void _ASUnlockScopeCleanup(id __strong *lockPtr) { +AS_INLINE void _ASUnlockScopeCleanup(id __strong *lockPtr) { [*lockPtr lock]; } @@ -160,7 +160,7 @@ namespace ASDN { public: #if !TIME_LOCKER - Locker (T &l) ASDISPLAYNODE_NOTHROW : _l (l) { + Locker (T &l) noexcept : _l (l) { _l.lock (); } @@ -174,7 +174,7 @@ namespace ASDN { #else - Locker (T &l, const char *name = NULL) ASDISPLAYNODE_NOTHROW : _l (l), _name(name) { + Locker (T &l, const char *name = NULL) noexcept : _l (l), _name(name) { _ti = CACurrentMediaTime(); _l.lock (); } @@ -204,7 +204,7 @@ namespace ASDN { public: #if !TIME_LOCKER - SharedLocker (std::shared_ptr const& l) ASDISPLAYNODE_NOTHROW : _l (l) { + SharedLocker (std::shared_ptr const& l) noexcept : _l (l) { ASDisplayNodeCAssertTrue(_l != nullptr); _l->lock (); } @@ -219,7 +219,7 @@ namespace ASDN { #else - SharedLocker (std::shared_ptr const& l, const char *name = NULL) ASDISPLAYNODE_NOTHROW : _l (l), _name(name) { + SharedLocker (std::shared_ptr const& l, const char *name = NULL) noexcept : _l (l), _name(name) { _ti = CACurrentMediaTime(); _l->lock (); } @@ -241,7 +241,7 @@ namespace ASDN { { T &_l; public: - Unlocker (T &l) ASDISPLAYNODE_NOTHROW : _l (l) { _l.unlock (); } + Unlocker (T &l) noexcept : _l (l) { _l.unlock (); } ~Unlocker () {_l.lock ();} Unlocker(Unlocker&) = delete; Unlocker &operator=(Unlocker&) = delete; diff --git a/Source/Details/ASTraitCollection.h b/Source/Details/ASTraitCollection.h index fbea570c..27d60ec6 100644 --- a/Source/Details/ASTraitCollection.h +++ b/Source/Details/ASTraitCollection.h @@ -26,7 +26,6 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN #pragma mark - ASPrimitiveContentSizeCategory @@ -54,7 +53,7 @@ typedef __unsafe_unretained UIContentSizeCategory ASPrimitiveContentSizeCategory * * @return a pointer to one of the UIContentSizeCategory constants. */ -extern ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeCategory sizeCategory); +AS_EXTERN ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeCategory sizeCategory); #pragma mark - ASPrimitiveTraitCollection @@ -88,31 +87,28 @@ typedef struct ASPrimitiveTraitCollection { /** * Creates ASPrimitiveTraitCollection with default values. */ -extern ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault(void); +AS_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault(void); /** * Creates a ASPrimitiveTraitCollection from a given UITraitCollection. */ -extern ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection); - +AS_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection); /** * Compares two ASPrimitiveTraitCollection to determine if they are the same. */ -extern BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs); +AS_EXTERN BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs); /** * Returns a string representation of a ASPrimitiveTraitCollection. */ -extern NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits); +AS_EXTERN NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits); /** * This function will walk the layout element hierarchy and updates the layout element trait collection for every * layout element within the hierarchy. */ -extern void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection); /** * Abstraction on top of UITraitCollection for propagation within AsyncDisplayKit-Layout @@ -240,7 +236,7 @@ AS_SUBCLASSING_RESTRICTED @interface ASTraitCollection (Deprecated) -- (instancetype)init ASDISPLAYNODE_DEPRECATED_MSG("The default constructor of this class is going to become unavailable. Use other constructors instead."); +- (instancetype)init AS_DEPRECATED_MSG("The default constructor of this class is going to become unavailable. Use other constructors instead."); + (ASTraitCollection *)traitCollectionWithDisplayScale:(CGFloat)displayScale userInterfaceIdiom:(UIUserInterfaceIdiom)userInterfaceIdiom @@ -248,7 +244,7 @@ AS_SUBCLASSING_RESTRICTED verticalSizeClass:(UIUserInterfaceSizeClass)verticalSizeClass forceTouchCapability:(UIForceTouchCapability)forceTouchCapability containerSize:(CGSize)windowSize - NS_RETURNS_RETAINED ASDISPLAYNODE_DEPRECATED_MSG("Use full version of this method instead."); + NS_RETURNS_RETAINED AS_DEPRECATED_MSG("Use full version of this method instead."); @end diff --git a/Source/Details/ASTraitCollection.m b/Source/Details/ASTraitCollection.m index 9b1902c9..787d97c9 100644 --- a/Source/Details/ASTraitCollection.m +++ b/Source/Details/ASTraitCollection.m @@ -24,7 +24,7 @@ // UIContentSizeCategoryUnspecified is available only in iOS 10.0 and later. // This is used for compatibility with older iOS versions. -ASDISPLAYNODE_INLINE UIContentSizeCategory AS_UIContentSizeCategoryUnspecified() { +AS_INLINE UIContentSizeCategory AS_UIContentSizeCategoryUnspecified() { if (AS_AVAILABLE_IOS(10)) { return UIContentSizeCategoryUnspecified; } else { @@ -32,8 +32,8 @@ ASDISPLAYNODE_INLINE UIContentSizeCategory AS_UIContentSizeCategoryUnspecified() } } -ASDISPLAYNODE_INLINE UIContentSizeCategory _Nonnull AS_safeContentSizeCategory(UIContentSizeCategory _Nullable sizeCategory) { - return sizeCategory ? sizeCategory : AS_UIContentSizeCategoryUnspecified(); +AS_INLINE UIContentSizeCategory _Nonnull AS_safeContentSizeCategory(UIContentSizeCategory _Nullable sizeCategory) { + return sizeCategory ?: AS_UIContentSizeCategoryUnspecified(); } ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeCategory sizeCategory) { @@ -80,7 +80,7 @@ ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeC #pragma mark - ASPrimitiveTraitCollection -extern void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection) { +AS_EXTERN void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection) { if (element) { element.primitiveTraitCollection = traitCollection; } @@ -147,7 +147,7 @@ BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTr } // Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceIdiom(UIUserInterfaceIdiom idiom) { +AS_INLINE NSString *AS_NSStringFromUIUserInterfaceIdiom(UIUserInterfaceIdiom idiom) { switch (idiom) { case UIUserInterfaceIdiomTV: return @"TV"; @@ -163,7 +163,7 @@ ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceIdiom(UIUserInterfa } // Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIForceTouchCapability(UIForceTouchCapability capability) { +AS_INLINE NSString *AS_NSStringFromUIForceTouchCapability(UIForceTouchCapability capability) { switch (capability) { case UIForceTouchCapabilityAvailable: return @"Available"; @@ -175,7 +175,7 @@ ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIForceTouchCapability(UIForceTouc } // Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceSizeClass(UIUserInterfaceSizeClass sizeClass) { +AS_INLINE NSString *AS_NSStringFromUIUserInterfaceSizeClass(UIUserInterfaceSizeClass sizeClass) { switch (sizeClass) { case UIUserInterfaceSizeClassCompact: return @"Compact"; @@ -187,7 +187,7 @@ ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceSizeClass(UIUserInt } // Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIDisplayGamut(UIDisplayGamut displayGamut) { +AS_INLINE NSString *AS_NSStringFromUIDisplayGamut(UIDisplayGamut displayGamut) { switch (displayGamut) { case UIDisplayGamutSRGB: return @"sRGB"; @@ -199,7 +199,7 @@ ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIDisplayGamut(UIDisplayGamut disp } // Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUITraitEnvironmentLayoutDirection(UITraitEnvironmentLayoutDirection layoutDirection) { +AS_INLINE NSString *AS_NSStringFromUITraitEnvironmentLayoutDirection(UITraitEnvironmentLayoutDirection layoutDirection) { switch (layoutDirection) { case UITraitEnvironmentLayoutDirectionLeftToRight: return @"LeftToRight"; @@ -212,7 +212,7 @@ ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUITraitEnvironmentLayoutDirection( #if TARGET_OS_TV // Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceStyle(UIUserInterfaceStyle userInterfaceStyle) { +AS_INLINE NSString *AS_NSStringFromUIUserInterfaceStyle(UIUserInterfaceStyle userInterfaceStyle) { switch (userInterfaceStyle) { case UIUserInterfaceStyleLight: return @"Light"; diff --git a/Source/Details/CoreGraphics+ASConvenience.h b/Source/Details/CoreGraphics+ASConvenience.h index d4ec5ce0..5455e472 100644 --- a/Source/Details/CoreGraphics+ASConvenience.h +++ b/Source/Details/CoreGraphics+ASConvenience.h @@ -33,9 +33,8 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN -ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromString(NSString *string) +AS_INLINE CGFloat ASCGFloatFromString(NSString *string) { #if CGFLOAT_IS_DOUBLE return string.doubleValue; @@ -44,7 +43,7 @@ ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromString(NSString *string) #endif } -ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromNumber(NSNumber *number) +AS_INLINE CGFloat ASCGFloatFromNumber(NSNumber *number) { #if CGFLOAT_IS_DOUBLE return number.doubleValue; @@ -53,11 +52,9 @@ ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromNumber(NSNumber *number) #endif } -ASDISPLAYNODE_INLINE BOOL CGSizeEqualToSizeWithIn(CGSize size1, CGSize size2, CGFloat delta) +AS_INLINE BOOL CGSizeEqualToSizeWithIn(CGSize size1, CGSize size2, CGFloat delta) { return fabs(size1.width - size2.width) < delta && fabs(size1.height - size2.height) < delta; }; -ASDISPLAYNODE_EXTERN_C_END - NS_ASSUME_NONNULL_END diff --git a/Source/Details/Transactions/_ASAsyncTransaction.h b/Source/Details/Transactions/_ASAsyncTransaction.h index ffcc7565..f22de659 100644 --- a/Source/Details/Transactions/_ASAsyncTransaction.h +++ b/Source/Details/Transactions/_ASAsyncTransaction.h @@ -16,6 +16,7 @@ // #import +#import NS_ASSUME_NONNULL_BEGIN @@ -39,7 +40,7 @@ typedef NS_ENUM(NSUInteger, ASAsyncTransactionState) { ASAsyncTransactionStateComplete }; -extern NSInteger const ASDefaultTransactionPriority; +AS_EXTERN NSInteger const ASDefaultTransactionPriority; /** @summary ASAsyncTransaction provides lightweight transaction semantics for asynchronous operations. diff --git a/Source/Details/_ASDisplayLayer.h b/Source/Details/_ASDisplayLayer.h index 1fbeede7..451bcbaf 100644 --- a/Source/Details/_ASDisplayLayer.h +++ b/Source/Details/_ASDisplayLayer.h @@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN */ + (void)drawRect:(CGRect)bounds withParameters:(nullable id)parameters - isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock + isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing; /** @@ -123,7 +123,7 @@ NS_ASSUME_NONNULL_BEGIN @return A UIImage with contents that are ready to display on the main thread. Make sure that the image is already decoded before returning it here. */ + (UIImage *)displayWithParameters:(nullable id)parameters - isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock; + isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock; // Called on the main thread only diff --git a/Source/Details/_ASDisplayViewAccessiblity.mm b/Source/Details/_ASDisplayViewAccessiblity.mm index 1f336ac5..a122310f 100644 --- a/Source/Details/_ASDisplayViewAccessiblity.mm +++ b/Source/Details/_ASDisplayViewAccessiblity.mm @@ -26,7 +26,7 @@ #import -NS_INLINE UIAccessibilityTraits InteractiveAccessibilityTraitsMask() { +AS_INLINE UIAccessibilityTraits InteractiveAccessibilityTraitsMask() { return UIAccessibilityTraitLink | UIAccessibilityTraitKeyboardKey | UIAccessibilityTraitButton; } diff --git a/Source/Layout/ASDimension.h b/Source/Layout/ASDimension.h index 851f519e..2955a3a5 100644 --- a/Source/Layout/ASDimension.h +++ b/Source/Layout/ASDimension.h @@ -21,42 +21,41 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN NS_ASSUME_NONNULL_BEGIN #pragma mark - -ASDISPLAYNODE_INLINE BOOL AS_WARN_UNUSED_RESULT ASPointsValidForLayout(CGFloat points) +AS_INLINE BOOL AS_WARN_UNUSED_RESULT ASPointsValidForLayout(CGFloat points) { return ((isnormal(points) || points == 0.0) && points >= 0.0 && points < (CGFLOAT_MAX / 2.0)); } -ASDISPLAYNODE_INLINE BOOL AS_WARN_UNUSED_RESULT ASIsCGSizeValidForLayout(CGSize size) +AS_INLINE BOOL AS_WARN_UNUSED_RESULT ASIsCGSizeValidForLayout(CGSize size) { return (ASPointsValidForLayout(size.width) && ASPointsValidForLayout(size.height)); } -ASDISPLAYNODE_INLINE BOOL AS_WARN_UNUSED_RESULT ASPointsValidForSize(CGFloat points) +AS_INLINE BOOL AS_WARN_UNUSED_RESULT ASPointsValidForSize(CGFloat points) { return ((isnormal(points) || points == 0.0) && points >= 0.0 && points < (FLT_MAX / 2.0)); } -ASDISPLAYNODE_INLINE BOOL AS_WARN_UNUSED_RESULT ASIsCGSizeValidForSize(CGSize size) +AS_INLINE BOOL AS_WARN_UNUSED_RESULT ASIsCGSizeValidForSize(CGSize size) { return (ASPointsValidForSize(size.width) && ASPointsValidForSize(size.height)); } -ASDISPLAYNODE_INLINE BOOL ASIsCGPositionPointsValidForLayout(CGFloat points) +AS_INLINE BOOL ASIsCGPositionPointsValidForLayout(CGFloat points) { return ((isnormal(points) || points == 0.0) && points < (CGFLOAT_MAX / 2.0)); } -ASDISPLAYNODE_INLINE BOOL ASIsCGPositionValidForLayout(CGPoint point) +AS_INLINE BOOL ASIsCGPositionValidForLayout(CGPoint point) { return (ASIsCGPositionPointsValidForLayout(point.x) && ASIsCGPositionPointsValidForLayout(point.y)); } -ASDISPLAYNODE_INLINE BOOL ASIsCGRectValidForLayout(CGRect rect) +AS_INLINE BOOL ASIsCGRectValidForLayout(CGRect rect) { return (ASIsCGPositionValidForLayout(rect.origin) && ASIsCGSizeValidForLayout(rect.size)); } @@ -90,12 +89,12 @@ typedef struct { /** * Represents auto as ASDimension */ -extern ASDimension const ASDimensionAuto; +AS_EXTERN ASDimension const ASDimensionAuto; /** * Returns a dimension with the specified type and value. */ -ASOVERLOADABLE ASDISPLAYNODE_INLINE ASDimension ASDimensionMake(ASDimensionUnit unit, CGFloat value) +AS_OVERLOADABLE AS_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMake(ASDimensionUnit unit, CGFloat value) { if (unit == ASDimensionUnitAuto ) { ASDisplayNodeCAssert(value == 0, @"ASDimension auto value must be 0."); @@ -113,7 +112,7 @@ ASOVERLOADABLE ASDISPLAYNODE_INLINE ASDimension ASDimensionMake(ASDimensionUnit /** * Returns a dimension with the specified points value. */ -ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMake(CGFloat points) +AS_OVERLOADABLE AS_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMake(CGFloat points) { return ASDimensionMake(ASDimensionUnitPoints, points); } @@ -123,12 +122,12 @@ ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensio * Examples: ASDimensionMake(@"50%") = ASDimensionMake(ASDimensionUnitFraction, 0.5) * ASDimensionMake(@"0.5pt") = ASDimensionMake(ASDimensionUnitPoints, 0.5) */ -ASOVERLOADABLE AS_WARN_UNUSED_RESULT extern ASDimension ASDimensionMake(NSString *dimension); +AS_OVERLOADABLE AS_WARN_UNUSED_RESULT AS_EXTERN ASDimension ASDimensionMake(NSString *dimension); /** * Returns a dimension with the specified points value. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMakeWithPoints(CGFloat points) +AS_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMakeWithPoints(CGFloat points) { ASDisplayNodeCAssertPositiveReal(@"Points", points); return ASDimensionMake(ASDimensionUnitPoints, points); @@ -137,7 +136,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMakeWithPoints /** * Returns a dimension with the specified fraction value. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMakeWithFraction(CGFloat fraction) +AS_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMakeWithFraction(CGFloat fraction) { ASDisplayNodeCAssert( 0 <= fraction && fraction <= 1.0, @"ASDimension fraction value (%f) must be between 0 and 1.", fraction); return ASDimensionMake(ASDimensionUnitFraction, fraction); @@ -146,7 +145,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMakeWithFracti /** * Returns whether two dimensions are equal. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASDimensionEqualToDimension(ASDimension lhs, ASDimension rhs) +AS_INLINE AS_WARN_UNUSED_RESULT BOOL ASDimensionEqualToDimension(ASDimension lhs, ASDimension rhs) { return (lhs.unit == rhs.unit && lhs.value == rhs.value); } @@ -154,12 +153,12 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASDimensionEqualToDimension(ASDi /** * Returns a NSString representation of a dimension. */ -extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASDimension(ASDimension dimension); +AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASDimension(ASDimension dimension); /** * Resolve this dimension to a parent size. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT CGFloat ASDimensionResolve(ASDimension dimension, CGFloat parentSize, CGFloat autoSize) +AS_INLINE AS_WARN_UNUSED_RESULT CGFloat ASDimensionResolve(ASDimension dimension, CGFloat parentSize, CGFloat autoSize) { switch (dimension.unit) { case ASDimensionUnitAuto: @@ -181,12 +180,12 @@ typedef struct { ASDimension height; } ASLayoutSize; -extern ASLayoutSize const ASLayoutSizeAuto; +AS_EXTERN ASLayoutSize const ASLayoutSizeAuto; /* * Creates an ASLayoutSize with provided min and max dimensions. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutSize ASLayoutSizeMake(ASDimension width, ASDimension height) +AS_INLINE AS_WARN_UNUSED_RESULT ASLayoutSize ASLayoutSizeMake(ASDimension width, ASDimension height) { ASLayoutSize size; size.width = width; @@ -197,7 +196,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutSize ASLayoutSizeMake(ASDimen /** * Resolve this relative size relative to a parent size. */ -ASDISPLAYNODE_INLINE CGSize ASLayoutSizeResolveSize(ASLayoutSize layoutSize, CGSize parentSize, CGSize autoSize) +AS_INLINE CGSize ASLayoutSizeResolveSize(ASLayoutSize layoutSize, CGSize parentSize, CGSize autoSize) { return CGSizeMake(ASDimensionResolve(layoutSize.width, parentSize.width, autoSize.width), ASDimensionResolve(layoutSize.height, parentSize.height, autoSize.height)); @@ -206,7 +205,7 @@ ASDISPLAYNODE_INLINE CGSize ASLayoutSizeResolveSize(ASLayoutSize layoutSize, CGS /* * Returns a string representation of a relative size. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutSize(ASLayoutSize size) +AS_INLINE AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutSize(ASLayoutSize size) { return [NSString stringWithFormat:@"{%@, %@}", NSStringFromASDimension(size.width), @@ -226,17 +225,17 @@ typedef struct { /** * A size range with all dimensions zero. */ -extern ASSizeRange const ASSizeRangeZero; +AS_EXTERN ASSizeRange const ASSizeRangeZero; /** * A size range from zero to infinity in both directions. */ -extern ASSizeRange const ASSizeRangeUnconstrained; +AS_EXTERN ASSizeRange const ASSizeRangeUnconstrained; /** * Returns whether a size range has > 0.1 max width and max height. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeHasSignificantArea(ASSizeRange sizeRange) +AS_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeHasSignificantArea(ASSizeRange sizeRange) { static CGFloat const limit = 0.1f; return (sizeRange.max.width > limit && sizeRange.max.height > limit); @@ -245,7 +244,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeHasSignificantArea(AS /** * Creates an ASSizeRange with provided min and max size. */ -ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeMake(CGSize min, CGSize max) +AS_OVERLOADABLE AS_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeMake(CGSize min, CGSize max) { ASDisplayNodeCAssertPositiveReal(@"Range min width", min.width); ASDisplayNodeCAssertPositiveReal(@"Range min height", min.height); @@ -264,7 +263,7 @@ ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRang /** * Creates an ASSizeRange with provided size as both min and max. */ -ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeMake(CGSize exactSize) +AS_OVERLOADABLE AS_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeMake(CGSize exactSize) { return ASSizeRangeMake(exactSize, exactSize); } @@ -272,7 +271,7 @@ ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRang /** * Clamps the provided CGSize between the [min, max] bounds of this ASSizeRange. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT CGSize ASSizeRangeClamp(ASSizeRange sizeRange, CGSize size) +AS_INLINE AS_WARN_UNUSED_RESULT CGSize ASSizeRangeClamp(ASSizeRange sizeRange, CGSize size) { return CGSizeMake(MAX(sizeRange.min.width, MIN(sizeRange.max.width, size.width)), MAX(sizeRange.min.height, MIN(sizeRange.max.height, size.height))); @@ -282,12 +281,12 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT CGSize ASSizeRangeClamp(ASSizeRange s * Intersects another size range. If the other size range does not overlap in either dimension, this size range * "wins" by returning a single point within its own range that is closest to the non-overlapping range. */ -extern AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange); +AS_EXTERN AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange); /** * Returns whether two size ranges are equal in min and max size. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeEqualToSizeRange(ASSizeRange lhs, ASSizeRange rhs) +AS_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeEqualToSizeRange(ASSizeRange lhs, ASSizeRange rhs) { return CGSizeEqualToSize(lhs.min, rhs.min) && CGSizeEqualToSize(lhs.max, rhs.max); } @@ -295,7 +294,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeEqualToSizeRange(ASSi /** * Returns a string representation of a size range */ -extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASSizeRange(ASSizeRange sizeRange); +AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASSizeRange(ASSizeRange sizeRange); #if YOGA @@ -313,11 +312,10 @@ typedef struct { ASDimension all; } ASEdgeInsets; -extern ASEdgeInsets const ASEdgeInsetsZero; +AS_EXTERN ASEdgeInsets const ASEdgeInsetsZero; -extern ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets); +AS_EXTERN ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets); #endif NS_ASSUME_NONNULL_END -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/Layout/ASDimension.mm b/Source/Layout/ASDimension.mm index 2a9ccbbb..dbb9b449 100644 --- a/Source/Layout/ASDimension.mm +++ b/Source/Layout/ASDimension.mm @@ -25,7 +25,7 @@ ASDimension const ASDimensionAuto = {ASDimensionUnitAuto, 0}; -ASOVERLOADABLE ASDimension ASDimensionMake(NSString *dimension) +AS_OVERLOADABLE ASDimension ASDimensionMake(NSString *dimension) { if (dimension.length > 0) { @@ -121,7 +121,7 @@ NSString *NSStringFromASSizeRange(ASSizeRange sizeRange) #pragma mark - Yoga - ASEdgeInsets ASEdgeInsets const ASEdgeInsetsZero = {}; -extern ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets) +AS_EXTERN ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets) { ASEdgeInsets asEdgeInsets = ASEdgeInsetsZero; asEdgeInsets.top = ASDimensionMake(edgeInsets.top); diff --git a/Source/Layout/ASDimensionInternal.h b/Source/Layout/ASDimensionInternal.h index 080500bc..7e974ffa 100644 --- a/Source/Layout/ASDimensionInternal.h +++ b/Source/Layout/ASDimensionInternal.h @@ -19,7 +19,6 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN NS_ASSUME_NONNULL_BEGIN #pragma mark - ASLayoutElementSize @@ -48,7 +47,7 @@ typedef struct { /** * Returns an ASLayoutElementSize with default values. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutElementSize ASLayoutElementSizeMake() +AS_INLINE AS_WARN_UNUSED_RESULT ASLayoutElementSize ASLayoutElementSizeMake() { return (ASLayoutElementSize){ .width = ASDimensionAuto, @@ -63,7 +62,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutElementSize ASLayoutElementSi /** * Returns an ASLayoutElementSize with the specified CGSize values as width and height. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutElementSize ASLayoutElementSizeMakeFromCGSize(CGSize size) +AS_INLINE AS_WARN_UNUSED_RESULT ASLayoutElementSize ASLayoutElementSizeMakeFromCGSize(CGSize size) { ASLayoutElementSize s = ASLayoutElementSizeMake(); s.width = ASDimensionMakeWithPoints(size.width); @@ -74,7 +73,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutElementSize ASLayoutElementSi /** * Returns whether two sizes are equal. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutElementSizeEqualToLayoutElementSize(ASLayoutElementSize lhs, ASLayoutElementSize rhs) +AS_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutElementSizeEqualToLayoutElementSize(ASLayoutElementSize lhs, ASLayoutElementSize rhs) { return (ASDimensionEqualToDimension(lhs.width, rhs.width) && ASDimensionEqualToDimension(lhs.height, rhs.height) @@ -87,7 +86,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutElementSizeEqualToLayout /** * Returns a string formatted to contain the data from an ASLayoutElementSize. */ -extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size); +AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size); /** * Resolve the given size relative to a parent size and an auto size. @@ -96,17 +95,16 @@ extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutE * dimension with unit ASDimensionUnitAuto the given autoASSizeRange value will be used. * Based on the calculated exact, min and max size constraints the final size range will be calculated. */ -extern AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange); +AS_EXTERN AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange); /** * Resolve the given size to a parent size. Uses internally ASLayoutElementSizeResolveAutoSize with {INFINITY, INFINITY} as * as autoASSizeRange. For more information look at ASLayoutElementSizeResolveAutoSize. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolve(ASLayoutElementSize size, const CGSize parentSize) +AS_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolve(ASLayoutElementSize size, const CGSize parentSize) { return ASLayoutElementSizeResolveAutoSize(size, parentSize, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); } NS_ASSUME_NONNULL_END -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/Layout/ASDimensionInternal.mm b/Source/Layout/ASDimensionInternal.mm index 1774a993..65fff6de 100644 --- a/Source/Layout/ASDimensionInternal.mm +++ b/Source/Layout/ASDimensionInternal.mm @@ -28,7 +28,7 @@ NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size) NSStringFromASLayoutSize(ASLayoutSizeMake(size.maxWidth, size.maxHeight))]; } -ASDISPLAYNODE_INLINE void ASLayoutElementSizeConstrain(CGFloat minVal, CGFloat exactVal, CGFloat maxVal, CGFloat *outMin, CGFloat *outMax) +AS_INLINE void ASLayoutElementSizeConstrain(CGFloat minVal, CGFloat exactVal, CGFloat maxVal, CGFloat *outMin, CGFloat *outMax) { NSCAssert(!isnan(minVal), @"minVal must not be NaN"); NSCAssert(!isnan(maxVal), @"maxVal must not be NaN"); diff --git a/Source/Layout/ASLayout.h b/Source/Layout/ASLayout.h index 829dc462..e007a7b1 100644 --- a/Source/Layout/ASLayout.h +++ b/Source/Layout/ASLayout.h @@ -22,18 +22,17 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN -extern CGPoint const ASPointNull; // {NAN, NAN} +AS_EXTERN CGPoint const ASPointNull; // {NAN, NAN} -extern BOOL ASPointIsNull(CGPoint point); +AS_EXTERN BOOL ASPointIsNull(CGPoint point); /** * Safely calculates the layout of the given root layoutElement by guarding against nil nodes. * @param rootLayoutElement The root node to calculate the layout for. * @param sizeRange The size range to calculate the root layout within. */ -extern ASLayout *ASCalculateRootLayout(id rootLayoutElement, const ASSizeRange sizeRange); +AS_EXTERN ASLayout *ASCalculateRootLayout(id rootLayoutElement, const ASSizeRange sizeRange) NS_RETURNS_RETAINED; /** * Safely computes the layout of the given node by guarding against nil nodes. @@ -41,9 +40,7 @@ extern ASLayout *ASCalculateRootLayout(id rootLayoutElement, co * @param sizeRange The size range to calculate the node layout within. * @param parentSize The parent size of the node to calculate the layout for. */ -extern ASLayout *ASCalculateLayout(idlayoutElement, const ASSizeRange sizeRange, const CGSize parentSize); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN ASLayout *ASCalculateLayout(idlayoutElement, const ASSizeRange sizeRange, const CGSize parentSize) NS_RETURNS_RETAINED; /** * A node in the layout tree that represents the size and position of the object that created it (ASLayoutElement). diff --git a/Source/Layout/ASLayout.mm b/Source/Layout/ASLayout.mm index 2400fa41..ff4a279d 100644 --- a/Source/Layout/ASLayout.mm +++ b/Source/Layout/ASLayout.mm @@ -30,7 +30,7 @@ CGPoint const ASPointNull = {NAN, NAN}; -extern BOOL ASPointIsNull(CGPoint point) +AS_EXTERN BOOL ASPointIsNull(CGPoint point) { return isnan(point.x) && isnan(point.y); } @@ -38,7 +38,7 @@ extern BOOL ASPointIsNull(CGPoint point) /** * Creates an defined number of " |" indent blocks for the recursive description. */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT NSString * descriptionIndents(NSUInteger indents) +AS_INLINE AS_WARN_UNUSED_RESULT NSString * descriptionIndents(NSUInteger indents) { NSMutableString *description = [NSMutableString string]; for (NSUInteger i = 0; i < indents; i++) { @@ -50,12 +50,12 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT NSString * descriptionIndents(NSUInte return description; } -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutIsDisplayNodeType(ASLayout *layout) +AS_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutIsDisplayNodeType(ASLayout *layout) { return layout.type == ASLayoutElementTypeDisplayNode; } -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutIsFlattened(ASLayout *layout) +AS_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutIsFlattened(ASLayout *layout) { // A layout is flattened if its position is null, and all of its sublayouts are of type displaynode with no sublayouts. if (! ASPointIsNull(layout.position)) { diff --git a/Source/Layout/ASLayoutElement.h b/Source/Layout/ASLayoutElement.h index 0d35fe67..4a363d3d 100644 --- a/Source/Layout/ASLayoutElement.h +++ b/Source/Layout/ASLayoutElement.h @@ -33,10 +33,10 @@ NS_ASSUME_NONNULL_BEGIN /** A constant that indicates that the parent's size is not yet determined in a given dimension. */ -extern CGFloat const ASLayoutElementParentDimensionUndefined; +AS_EXTERN CGFloat const ASLayoutElementParentDimensionUndefined; /** A constant that indicates that the parent's size is not yet determined in either dimension. */ -extern CGSize const ASLayoutElementParentSizeUndefined; +AS_EXTERN CGSize const ASLayoutElementParentSizeUndefined; /** Type of ASLayoutElement */ typedef NS_ENUM(NSUInteger, ASLayoutElementType) { @@ -152,24 +152,24 @@ typedef NS_ENUM(NSUInteger, ASLayoutElementType) { #pragma mark - ASLayoutElementStyle -extern NSString * const ASLayoutElementStyleWidthProperty; -extern NSString * const ASLayoutElementStyleMinWidthProperty; -extern NSString * const ASLayoutElementStyleMaxWidthProperty; +AS_EXTERN NSString * const ASLayoutElementStyleWidthProperty; +AS_EXTERN NSString * const ASLayoutElementStyleMinWidthProperty; +AS_EXTERN NSString * const ASLayoutElementStyleMaxWidthProperty; -extern NSString * const ASLayoutElementStyleHeightProperty; -extern NSString * const ASLayoutElementStyleMinHeightProperty; -extern NSString * const ASLayoutElementStyleMaxHeightProperty; +AS_EXTERN NSString * const ASLayoutElementStyleHeightProperty; +AS_EXTERN NSString * const ASLayoutElementStyleMinHeightProperty; +AS_EXTERN NSString * const ASLayoutElementStyleMaxHeightProperty; -extern NSString * const ASLayoutElementStyleSpacingBeforeProperty; -extern NSString * const ASLayoutElementStyleSpacingAfterProperty; -extern NSString * const ASLayoutElementStyleFlexGrowProperty; -extern NSString * const ASLayoutElementStyleFlexShrinkProperty; -extern NSString * const ASLayoutElementStyleFlexBasisProperty; -extern NSString * const ASLayoutElementStyleAlignSelfProperty; -extern NSString * const ASLayoutElementStyleAscenderProperty; -extern NSString * const ASLayoutElementStyleDescenderProperty; +AS_EXTERN NSString * const ASLayoutElementStyleSpacingBeforeProperty; +AS_EXTERN NSString * const ASLayoutElementStyleSpacingAfterProperty; +AS_EXTERN NSString * const ASLayoutElementStyleFlexGrowProperty; +AS_EXTERN NSString * const ASLayoutElementStyleFlexShrinkProperty; +AS_EXTERN NSString * const ASLayoutElementStyleFlexBasisProperty; +AS_EXTERN NSString * const ASLayoutElementStyleAlignSelfProperty; +AS_EXTERN NSString * const ASLayoutElementStyleAscenderProperty; +AS_EXTERN NSString * const ASLayoutElementStyleDescenderProperty; -extern NSString * const ASLayoutElementStyleLayoutPositionProperty; +AS_EXTERN NSString * const ASLayoutElementStyleLayoutPositionProperty; @protocol ASLayoutElementStyleDelegate - (void)style:(__kindof ASLayoutElementStyle *)style propertyDidChange:(NSString *)propertyName; @@ -307,7 +307,7 @@ extern NSString * const ASLayoutElementStyleLayoutPositionProperty; @protocol ASLayoutElementStylability -- (instancetype)styledWithBlock:(AS_NOESCAPE void (^)(__kindof ASLayoutElementStyle *style))styleBlock; +- (instancetype)styledWithBlock:(void (NS_NOESCAPE ^)(__kindof ASLayoutElementStyle *style))styleBlock; @end diff --git a/Source/Layout/ASLayoutElementPrivate.h b/Source/Layout/ASLayoutElementPrivate.h index 96c520e5..263b2f84 100644 --- a/Source/Layout/ASLayoutElementPrivate.h +++ b/Source/Layout/ASLayoutElementPrivate.h @@ -30,16 +30,16 @@ AS_SUBCLASSING_RESTRICTED @property (nonatomic) int32_t transitionID; @end -extern int32_t const ASLayoutElementContextInvalidTransitionID; +AS_EXTERN int32_t const ASLayoutElementContextInvalidTransitionID; -extern int32_t const ASLayoutElementContextDefaultTransitionID; +AS_EXTERN int32_t const ASLayoutElementContextDefaultTransitionID; // Does not currently support nesting – there must be no current context. -extern void ASLayoutElementPushContext(ASLayoutElementContext * context); +AS_EXTERN void ASLayoutElementPushContext(ASLayoutElementContext * context); -extern ASLayoutElementContext * _Nullable ASLayoutElementGetCurrentContext(void); +AS_EXTERN ASLayoutElementContext * _Nullable ASLayoutElementGetCurrentContext(void); -extern void ASLayoutElementPopContext(void); +AS_EXTERN void ASLayoutElementPopContext(void); NS_ASSUME_NONNULL_END diff --git a/Source/Layout/ASLayoutSpec.mm b/Source/Layout/ASLayoutSpec.mm index 7b70df4e..97d8ff74 100644 --- a/Source/Layout/ASLayoutSpec.mm +++ b/Source/Layout/ASLayoutSpec.mm @@ -76,7 +76,7 @@ return _style; } -- (instancetype)styledWithBlock:(AS_NOESCAPE void (^)(__kindof ASLayoutElementStyle *style))styleBlock +- (instancetype)styledWithBlock:(void (NS_NOESCAPE ^)(__kindof ASLayoutElementStyle *style))styleBlock { styleBlock(self.style); return self; diff --git a/Source/Layout/ASStackLayoutDefines.h b/Source/Layout/ASStackLayoutDefines.h index 8490a538..44c6508c 100644 --- a/Source/Layout/ASStackLayoutDefines.h +++ b/Source/Layout/ASStackLayoutDefines.h @@ -120,13 +120,12 @@ typedef NS_ENUM(NSUInteger, ASHorizontalAlignment) { /** Right aligned */ ASHorizontalAlignmentRight, - // After 2.0 has landed, we'll add ASDISPLAYNODE_DEPRECATED here - for now, avoid triggering errors for projects with -Werror /** @deprecated Use ASHorizontalAlignmentLeft instead */ - ASAlignmentLeft ASDISPLAYNODE_DEPRECATED = ASHorizontalAlignmentLeft, + ASAlignmentLeft AS_DEPRECATED = ASHorizontalAlignmentLeft, /** @deprecated Use ASHorizontalAlignmentMiddle instead */ - ASAlignmentMiddle ASDISPLAYNODE_DEPRECATED = ASHorizontalAlignmentMiddle, + ASAlignmentMiddle AS_DEPRECATED = ASHorizontalAlignmentMiddle, /** @deprecated Use ASHorizontalAlignmentRight instead */ - ASAlignmentRight ASDISPLAYNODE_DEPRECATED = ASHorizontalAlignmentRight, + ASAlignmentRight AS_DEPRECATED = ASHorizontalAlignmentRight, }; /** Orientation of children along vertical axis */ @@ -140,11 +139,10 @@ typedef NS_ENUM(NSUInteger, ASVerticalAlignment) { /** Bottom aligned */ ASVerticalAlignmentBottom, - // After 2.0 has landed, we'll add ASDISPLAYNODE_DEPRECATED here - for now, avoid triggering errors for projects with -Werror /** @deprecated Use ASVerticalAlignmentTop instead */ - ASAlignmentTop ASDISPLAYNODE_DEPRECATED = ASVerticalAlignmentTop, + ASAlignmentTop AS_DEPRECATED = ASVerticalAlignmentTop, /** @deprecated Use ASVerticalAlignmentCenter instead */ - ASAlignmentCenter ASDISPLAYNODE_DEPRECATED = ASVerticalAlignmentCenter, + ASAlignmentCenter AS_DEPRECATED = ASVerticalAlignmentCenter, /** @deprecated Use ASVerticalAlignmentBottom instead */ - ASAlignmentBottom ASDISPLAYNODE_DEPRECATED = ASVerticalAlignmentBottom, + ASAlignmentBottom AS_DEPRECATED = ASVerticalAlignmentBottom, }; diff --git a/Source/Layout/ASYogaUtilities.h b/Source/Layout/ASYogaUtilities.h index b229b343..09e68e76 100644 --- a/Source/Layout/ASYogaUtilities.h +++ b/Source/Layout/ASYogaUtilities.h @@ -30,25 +30,24 @@ @end -extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); +AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); -ASDISPLAYNODE_EXTERN_C_BEGIN #pragma mark - Yoga Type Conversion Helpers -YGAlign yogaAlignItems(ASStackLayoutAlignItems alignItems); -YGJustify yogaJustifyContent(ASStackLayoutJustifyContent justifyContent); -YGAlign yogaAlignSelf(ASStackLayoutAlignSelf alignSelf); -YGFlexDirection yogaFlexDirection(ASStackLayoutDirection direction); -float yogaFloatForCGFloat(CGFloat value); -float yogaDimensionToPoints(ASDimension dimension); -float yogaDimensionToPercent(ASDimension dimension); -ASDimension dimensionForEdgeWithEdgeInsets(YGEdge edge, ASEdgeInsets insets); +AS_EXTERN YGAlign yogaAlignItems(ASStackLayoutAlignItems alignItems); +AS_EXTERN YGJustify yogaJustifyContent(ASStackLayoutJustifyContent justifyContent); +AS_EXTERN YGAlign yogaAlignSelf(ASStackLayoutAlignSelf alignSelf); +AS_EXTERN YGFlexDirection yogaFlexDirection(ASStackLayoutDirection direction); +AS_EXTERN float yogaFloatForCGFloat(CGFloat value); +AS_EXTERN float yogaDimensionToPoints(ASDimension dimension); +AS_EXTERN float yogaDimensionToPercent(ASDimension dimension); +AS_EXTERN ASDimension dimensionForEdgeWithEdgeInsets(YGEdge edge, ASEdgeInsets insets); -void ASLayoutElementYogaUpdateMeasureFunc(YGNodeRef yogaNode, id layoutElement); -YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, - float width, YGMeasureMode widthMode, - float height, YGMeasureMode heightMode); +AS_EXTERN void ASLayoutElementYogaUpdateMeasureFunc(YGNodeRef yogaNode, id layoutElement); +AS_EXTERN YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, + float width, YGMeasureMode widthMode, + float height, YGMeasureMode heightMode); #pragma mark - Yoga Style Setter Helpers @@ -79,6 +78,4 @@ YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, YGNodeStyleSet##property(yogaNode, edge, YGUndefined); \ } \ -ASDISPLAYNODE_EXTERN_C_END - #endif /* YOGA */ diff --git a/Source/Layout/ASYogaUtilities.mm b/Source/Layout/ASYogaUtilities.mm index 566f5c3f..8812e027 100644 --- a/Source/Layout/ASYogaUtilities.mm +++ b/Source/Layout/ASYogaUtilities.mm @@ -47,7 +47,7 @@ @end -extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) +AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) { if (node == nil) { return; diff --git a/Source/Private/ASBatchFetching.h b/Source/Private/ASBatchFetching.h index 7ff4eb06..39d18353 100644 --- a/Source/Private/ASBatchFetching.h +++ b/Source/Private/ASBatchFetching.h @@ -19,8 +19,6 @@ #import -ASDISPLAYNODE_EXTERN_C_BEGIN - NS_ASSUME_NONNULL_BEGIN @class ASBatchContext; @@ -46,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN @param velocity The velocity of the scroll view (in points) at the moment the touch was released. @return Whether or not the current state should proceed with batch fetching. */ -BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView *scrollView, +AS_EXTERN BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView *scrollView, ASScrollDirection scrollDirection, ASScrollDirection scrollableDirections, CGPoint contentOffset, @@ -69,7 +67,7 @@ BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView delegate); NS_ASSUME_NONNULL_END -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/Private/ASCollectionLayout.mm b/Source/Private/ASCollectionLayout.mm index eafc445a..a4743cc7 100644 --- a/Source/Private/ASCollectionLayout.mm +++ b/Source/Private/ASCollectionLayout.mm @@ -373,14 +373,14 @@ static const ASScrollDirection kASStaticScrollDirection = (ASScrollDirectionRigh # pragma mark - Convenient inline functions -ASDISPLAYNODE_INLINE ASSizeRange ASCollectionLayoutElementSizeRangeFromSize(CGSize size) +AS_INLINE ASSizeRange ASCollectionLayoutElementSizeRangeFromSize(CGSize size) { // The layout delegate consulted us that this element must fit within this size, // and the only way to achieve that without asking it again is to use an exact size range here. return ASSizeRangeMake(size); } -ASDISPLAYNODE_INLINE void ASCollectionLayoutSetSizeToElement(CGSize size, ASCollectionElement *element) +AS_INLINE void ASCollectionLayoutSetSizeToElement(CGSize size, ASCollectionElement *element) { if (ASCellNode *node = element.node) { if (! CGSizeEqualToSize(size, node.frame.size)) { diff --git a/Source/Private/ASCollectionLayoutDefines.h b/Source/Private/ASCollectionLayoutDefines.h index 07be880a..3c05cae4 100644 --- a/Source/Private/ASCollectionLayoutDefines.h +++ b/Source/Private/ASCollectionLayoutDefines.h @@ -18,10 +18,6 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN - -FOUNDATION_EXPORT ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) AS_WARN_UNUSED_RESULT; - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) AS_WARN_UNUSED_RESULT; NS_ASSUME_NONNULL_END diff --git a/Source/Private/ASCollectionLayoutDefines.m b/Source/Private/ASCollectionLayoutDefines.m index b8c9c21c..bfa58aa5 100644 --- a/Source/Private/ASCollectionLayoutDefines.m +++ b/Source/Private/ASCollectionLayoutDefines.m @@ -12,7 +12,7 @@ #import -extern ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) +AS_EXTERN ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) { ASSizeRange sizeRange = ASSizeRangeUnconstrained; if (ASScrollDirectionContainsVerticalDirection(scrollableDirections) == NO) { diff --git a/Source/Private/ASCollectionView+Undeprecated.h b/Source/Private/ASCollectionView+Undeprecated.h index 99814bdf..0d338ce5 100644 --- a/Source/Private/ASCollectionView+Undeprecated.h +++ b/Source/Private/ASCollectionView+Undeprecated.h @@ -154,7 +154,7 @@ NS_ASSUME_NONNULL_BEGIN * 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:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; +- (void)performBatchAnimated:(BOOL)animated updates:(nullable void (NS_NOESCAPE ^)(void))updates completion:(nullable void (^)(BOOL finished))completion; /** * Perform a batch of updates asynchronously. This method must be called from the main thread. @@ -165,7 +165,7 @@ NS_ASSUME_NONNULL_BEGIN * 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:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; +- (void)performBatchUpdates:(nullable void (NS_NOESCAPE ^)(void))updates completion:(nullable void (^)(BOOL finished))completion; /** * Triggers a relayout of all nodes. diff --git a/Source/Private/ASDispatch.h b/Source/Private/ASDispatch.h index 4f2a1cda..9ef40fdb 100644 --- a/Source/Private/ASDispatch.h +++ b/Source/Private/ASDispatch.h @@ -18,15 +18,13 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN - /** * Like dispatch_apply, but you can set the thread count. 0 means 2*active CPUs. * * Note: The actual number of threads may be lower than threadCount, if libdispatch * decides the system can't handle it. In reality this rarely happens. */ -void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); +AS_EXTERN void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, void(NS_NOESCAPE ^work)(size_t i)); /** * Like dispatch_async, but you can set the thread count. 0 means 2*active CPUs. @@ -34,6 +32,4 @@ void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger t * Note: The actual number of threads may be lower than threadCount, if libdispatch * decides the system can't handle it. In reality this rarely happens. */ -void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, void(NS_NOESCAPE ^work)(size_t i)); diff --git a/Source/Private/ASDispatch.m b/Source/Private/ASDispatch.m index 14c60eb6..851c0168 100644 --- a/Source/Private/ASDispatch.m +++ b/Source/Private/ASDispatch.m @@ -19,7 +19,7 @@ * Note: The actual number of threads may be lower than threadCount, if libdispatch * decides the system can't handle it. In reality this rarely happens. */ -void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)) { +void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, void(NS_NOESCAPE ^work)(size_t i)) { if (threadCount == 0) { threadCount = NSProcessInfo.processInfo.activeProcessorCount * 2; } @@ -42,7 +42,7 @@ void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger t * Note: The actual number of threads may be lower than threadCount, if libdispatch * decides the system can't handle it. In reality this rarely happens. */ -void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)) { +void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, void(NS_NOESCAPE ^work)(size_t i)) { if (threadCount == 0) { threadCount = NSProcessInfo.processInfo.activeProcessorCount * 2; } diff --git a/Source/Private/ASDisplayNode+FrameworkPrivate.h b/Source/Private/ASDisplayNode+FrameworkPrivate.h index 589d60c2..d0f4c2d1 100644 --- a/Source/Private/ASDisplayNode+FrameworkPrivate.h +++ b/Source/Private/ASDisplayNode+FrameworkPrivate.h @@ -58,22 +58,22 @@ typedef NS_OPTIONS(NSUInteger, ASHierarchyState) ASHierarchyStateLayoutPending = 1 << 3, }; -ASDISPLAYNODE_INLINE BOOL ASHierarchyStateIncludesLayoutPending(ASHierarchyState hierarchyState) +AS_INLINE BOOL ASHierarchyStateIncludesLayoutPending(ASHierarchyState hierarchyState) { return ((hierarchyState & ASHierarchyStateLayoutPending) == ASHierarchyStateLayoutPending); } -ASDISPLAYNODE_INLINE BOOL ASHierarchyStateIncludesRangeManaged(ASHierarchyState hierarchyState) +AS_INLINE BOOL ASHierarchyStateIncludesRangeManaged(ASHierarchyState hierarchyState) { return ((hierarchyState & ASHierarchyStateRangeManaged) == ASHierarchyStateRangeManaged); } -ASDISPLAYNODE_INLINE BOOL ASHierarchyStateIncludesRasterized(ASHierarchyState hierarchyState) +AS_INLINE BOOL ASHierarchyStateIncludesRasterized(ASHierarchyState hierarchyState) { return ((hierarchyState & ASHierarchyStateRasterized) == ASHierarchyStateRasterized); } -ASDISPLAYNODE_INLINE BOOL ASHierarchyStateIncludesTransitioningSupernodes(ASHierarchyState hierarchyState) +AS_INLINE BOOL ASHierarchyStateIncludesTransitioningSupernodes(ASHierarchyState hierarchyState) { return ((hierarchyState & ASHierarchyStateTransitioningSupernodes) == ASHierarchyStateTransitioningSupernodes); } diff --git a/Source/Private/ASDisplayNode+UIViewBridge.mm b/Source/Private/ASDisplayNode+UIViewBridge.mm index 939ed642..b767887b 100644 --- a/Source/Private/ASDisplayNode+UIViewBridge.mm +++ b/Source/Private/ASDisplayNode+UIViewBridge.mm @@ -58,7 +58,7 @@ /// *warning* the lock should *not* be released until the pending state is updated if this method /// returns NO. Otherwise, the pending state can be scheduled and flushed *before* you get a chance /// to apply it. -ASDISPLAYNODE_INLINE BOOL ASDisplayNodeShouldApplyBridgedWriteToView(ASDisplayNode *node) { +AS_INLINE BOOL ASDisplayNodeShouldApplyBridgedWriteToView(ASDisplayNode *node) { BOOL loaded = __loaded(node); if (ASDisplayNodeThreadIsMain()) { return loaded; diff --git a/Source/Private/ASImageNode+AnimatedImagePrivate.h b/Source/Private/ASImageNode+AnimatedImagePrivate.h index f77ee1f9..c6a2f177 100644 --- a/Source/Private/ASImageNode+AnimatedImagePrivate.h +++ b/Source/Private/ASImageNode+AnimatedImagePrivate.h @@ -17,7 +17,7 @@ #import -extern NSString *const ASAnimatedImageDefaultRunLoopMode; +AS_EXTERN NSString *const ASAnimatedImageDefaultRunLoopMode; @interface ASImageNode () { diff --git a/Source/Private/ASImageNode+CGExtras.h b/Source/Private/ASImageNode+CGExtras.h index f62380cd..187f4833 100644 --- a/Source/Private/ASImageNode+CGExtras.h +++ b/Source/Private/ASImageNode+CGExtras.h @@ -18,9 +18,6 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN - - /** @abstract Decides how to scale and crop an image to fit in the provided size, while not wasting memory by upscaling images @param sourceImageSize The size of the encoded image. @@ -31,7 +28,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN @param forcedSize A CGSize, that if non-CGSizeZero, indicates that the backing size should be forcedSize and not calculated based on boundsSize. @discussion If the image is smaller than the size and UIViewContentModeScaleToAspectFill is specified, we suggest the input size so it will be efficiently upscaled on the GPU by the displaying layer at composite time. */ -extern void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, +AS_EXTERN void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, CGSize boundsSize, UIViewContentMode contentMode, CGRect cropRect, @@ -40,5 +37,3 @@ extern void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, CGSize *outBackingSize, CGRect *outDrawRect ); - -ASDISPLAYNODE_EXTERN_C_END diff --git a/Source/Private/ASInternalHelpers.h b/Source/Private/ASInternalHelpers.h index 7bfca724..8608e9b3 100644 --- a/Source/Private/ASInternalHelpers.h +++ b/Source/Private/ASInternalHelpers.h @@ -23,47 +23,43 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN void ASInitializeFrameworkMainThread(void); -void ASInitializeFrameworkMainThread(void); +AS_EXTERN BOOL ASDefaultAllowsGroupOpacity(void); +AS_EXTERN BOOL ASDefaultAllowsEdgeAntialiasing(void); -BOOL ASDefaultAllowsGroupOpacity(void); -BOOL ASDefaultAllowsEdgeAntialiasing(void); - -BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector); -BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL selector); +AS_EXTERN BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector); +AS_EXTERN BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL selector); /// Replace a method from the given class with a block and returns the original method IMP -IMP ASReplaceMethodWithBlock(Class c, SEL origSEL, id block); +AS_EXTERN IMP ASReplaceMethodWithBlock(Class c, SEL origSEL, id block); /// Dispatches the given block to the main queue if not already running on the main thread -void ASPerformBlockOnMainThread(void (^block)(void)); +AS_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); /// Dispatches the given block to a background queue with priority of DISPATCH_QUEUE_PRIORITY_DEFAULT if not already run on a background queue -void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT +AS_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT /// For deallocation of objects on a background thread without GCD overhead / thread explosion -void ASPerformBackgroundDeallocation(id __strong _Nullable * _Nonnull object); +AS_EXTERN void ASPerformBackgroundDeallocation(id __strong _Nullable * _Nonnull object); -CGFloat ASScreenScale(void); +AS_EXTERN CGFloat ASScreenScale(void); -CGSize ASFloorSizeValues(CGSize s); +AS_EXTERN CGSize ASFloorSizeValues(CGSize s); -CGFloat ASFloorPixelValue(CGFloat f); +AS_EXTERN CGFloat ASFloorPixelValue(CGFloat f); -CGPoint ASCeilPointValues(CGPoint p); +AS_EXTERN CGPoint ASCeilPointValues(CGPoint p); -CGSize ASCeilSizeValues(CGSize s); +AS_EXTERN CGSize ASCeilSizeValues(CGSize s); -CGFloat ASCeilPixelValue(CGFloat f); +AS_EXTERN CGFloat ASCeilPixelValue(CGFloat f); -CGFloat ASRoundPixelValue(CGFloat f); +AS_EXTERN CGFloat ASRoundPixelValue(CGFloat f); -Class _Nullable ASGetClassFromType(const char * _Nullable type); +AS_EXTERN Class _Nullable ASGetClassFromType(const char * _Nullable type); -ASDISPLAYNODE_EXTERN_C_END - -ASDISPLAYNODE_INLINE BOOL ASImageAlphaInfoIsOpaque(CGImageAlphaInfo info) { +AS_INLINE BOOL ASImageAlphaInfoIsOpaque(CGImageAlphaInfo info) { switch (info) { case kCGImageAlphaNone: case kCGImageAlphaNoneSkipLast: @@ -83,7 +79,7 @@ ASDISPLAYNODE_INLINE BOOL ASImageAlphaInfoIsOpaque(CGImageAlphaInfo info) { @param withoutAnimation Set to `YES` to perform given block without animation @param block Perform UIView geometry changes within the passed block */ -ASDISPLAYNODE_INLINE void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)(void)) { +AS_INLINE void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)(void)) { if (withoutAnimation) { [UIView performWithoutAnimation:block]; } else { @@ -91,14 +87,14 @@ ASDISPLAYNODE_INLINE void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, } } -ASDISPLAYNODE_INLINE void ASBoundsAndPositionForFrame(CGRect rect, CGPoint origin, CGPoint anchorPoint, CGRect *bounds, CGPoint *position) +AS_INLINE void ASBoundsAndPositionForFrame(CGRect rect, CGPoint origin, CGPoint anchorPoint, CGRect *bounds, CGPoint *position) { *bounds = (CGRect){ origin, rect.size }; *position = CGPointMake(rect.origin.x + rect.size.width * anchorPoint.x, rect.origin.y + rect.size.height * anchorPoint.y); } -ASDISPLAYNODE_INLINE UIEdgeInsets ASConcatInsets(UIEdgeInsets insetsA, UIEdgeInsets insetsB) +AS_INLINE UIEdgeInsets ASConcatInsets(UIEdgeInsets insetsA, UIEdgeInsets insetsB) { insetsA.top += insetsB.top; insetsA.left += insetsB.left; diff --git a/Source/Private/ASTipNode.h b/Source/Private/ASTipNode.h index e5942142..0ddb552c 100644 --- a/Source/Private/ASTipNode.h +++ b/Source/Private/ASTipNode.h @@ -36,7 +36,7 @@ AS_SUBCLASSING_RESTRICTED - (instancetype)initWithTip:(ASTip *)tip NS_DESIGNATED_INITIALIZER; -- (instancetype)init NS_UNAVAILABLE; +- (instancetype)init AS_UNAVAILABLE_MSG; @property (nonatomic, readonly) ASTip *tip; diff --git a/Source/Private/ASTwoDimensionalArrayUtils.h b/Source/Private/ASTwoDimensionalArrayUtils.h index 3c1d5c81..2b3e5d7d 100644 --- a/Source/Private/ASTwoDimensionalArrayUtils.h +++ b/Source/Private/ASTwoDimensionalArrayUtils.h @@ -26,35 +26,30 @@ NS_ASSUME_NONNULL_BEGIN * Helper class for operation on two-dimensional array, where the objects of the root array are each arrays */ -ASDISPLAYNODE_EXTERN_C_BEGIN - /** * Deep mutable copy of an array that contains arrays, which contain objects. It will go one level deep into the array to copy. * This method is substantially faster than the generalized version, e.g. about 10x faster, so use it whenever it fits the need. */ -extern NSMutableArray *ASTwoDimensionalArrayDeepMutableCopy(NSArray *array) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSMutableArray *ASTwoDimensionalArrayDeepMutableCopy(NSArray *array) AS_WARN_UNUSED_RESULT; /** * Delete the elements of the mutable two-dimensional array at given index paths – sorted in descending order! */ -extern void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths); +AS_EXTERN void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths); /** * Return all the index paths of a two-dimensional array, in ascending order. */ -extern NSArray *ASIndexPathsForTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray *ASIndexPathsForTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; /** * Return all the elements of a two-dimensional array, in ascending order. */ -extern NSArray *ASElementsInTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; +AS_EXTERN NSArray *ASElementsInTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; /** * Attempt to get the object at the given index path. Returns @c nil if the index path is out of bounds. */ -extern id _Nullable ASGetElementInTwoDimensionalArray(NSArray *array, NSIndexPath *indexPath) AS_WARN_UNUSED_RESULT; - - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN id _Nullable ASGetElementInTwoDimensionalArray(NSArray *array, NSIndexPath *indexPath) AS_WARN_UNUSED_RESULT; NS_ASSUME_NONNULL_END diff --git a/Source/Private/ASTwoDimensionalArrayUtils.m b/Source/Private/ASTwoDimensionalArrayUtils.m index d1ce8136..c2513515 100644 --- a/Source/Private/ASTwoDimensionalArrayUtils.m +++ b/Source/Private/ASTwoDimensionalArrayUtils.m @@ -27,7 +27,7 @@ NSMutableArray *ASTwoDimensionalArrayDeepMutableCopy(NSArray *array) { - NSMutableArray *newArray = [NSMutableArray arrayWithCapacity:array.count]; + NSMutableArray *newArray = [[NSMutableArray alloc] initWithCapacity:array.count]; NSInteger i = 0; for (NSArray *subarray in array) { ASDisplayNodeCAssert([subarray isKindOfClass:[NSArray class]], @"This function expects NSArray *"); diff --git a/Source/Private/Layout/ASStackUnpositionedLayout.h b/Source/Private/Layout/ASStackUnpositionedLayout.h index 1f781de5..4347a4b0 100644 --- a/Source/Private/Layout/ASStackUnpositionedLayout.h +++ b/Source/Private/Layout/ASStackUnpositionedLayout.h @@ -22,7 +22,7 @@ #import /** The threshold that determines if a violation has actually occurred. */ -extern CGFloat const kViolationEpsilon; +AS_EXTERN CGFloat const kViolationEpsilon; struct ASStackLayoutSpecChild { /** The original source child. */ diff --git a/Source/Private/Layout/ASStackUnpositionedLayout.mm b/Source/Private/Layout/ASStackUnpositionedLayout.mm index 1dff9334..8abe8150 100644 --- a/Source/Private/Layout/ASStackUnpositionedLayout.mm +++ b/Source/Private/Layout/ASStackUnpositionedLayout.mm @@ -430,7 +430,7 @@ static std::function flexAdjustmentInVio } } -ASDISPLAYNODE_INLINE BOOL isFlexibleInBothDirections(const ASStackLayoutSpecChild &child) +AS_INLINE BOOL isFlexibleInBothDirections(const ASStackLayoutSpecChild &child) { return child.style.flexGrow > 0 && child.style.flexShrink > 0; } @@ -543,7 +543,7 @@ CGFloat ASStackUnpositionedLayout::computeStackViolation(const CGFloat stackDime If we have a single flexible (both shrinkable and growable) child, and our allowed size range is set to a specific number then we may avoid the first "intrinsic" size calculation. */ -ASDISPLAYNODE_INLINE BOOL useOptimizedFlexing(const std::vector &children, +AS_INLINE BOOL useOptimizedFlexing(const std::vector &children, const ASStackLayoutSpecStyle &style, const ASSizeRange &sizeRange) { diff --git a/Source/Private/TextExperiment/Component/ASTextLayout.h b/Source/Private/TextExperiment/Component/ASTextLayout.h index 17a137b3..544d9f5f 100755 --- a/Source/Private/TextExperiment/Component/ASTextLayout.h +++ b/Source/Private/TextExperiment/Component/ASTextLayout.h @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN /** The max text container size in layout. */ -extern const CGSize ASTextContainerMaxSize; +AS_EXTERN const CGSize ASTextContainerMaxSize; /** The ASTextContainer class defines a region in which text is laid out. diff --git a/Source/Private/TextExperiment/String/ASTextAttribute.h b/Source/Private/TextExperiment/String/ASTextAttribute.h index a5575a29..08446343 100755 --- a/Source/Private/TextExperiment/String/ASTextAttribute.h +++ b/Source/Private/TextExperiment/String/ASTextAttribute.h @@ -16,6 +16,7 @@ // #import +#import NS_ASSUME_NONNULL_BEGIN @@ -30,7 +31,7 @@ typedef NS_OPTIONS(NSInteger, ASTextAttributeType) { }; /// Get the attribute type from an attribute name. -extern ASTextAttributeType ASTextAttributeGetType(NSString *attributeName); +AS_EXTERN ASTextAttributeType ASTextAttributeGetType(NSString *attributeName); /** Line style in ASText (similar to NSUnderlineStyle). @@ -94,66 +95,66 @@ typedef NS_ENUM (NSUInteger, ASTextTruncationType) { /// The value of this attribute is a `ASTextBackedString` object. /// Use this attribute to store the original plain text if it is replaced by something else (such as attachment). -UIKIT_EXTERN NSString *const ASTextBackedStringAttributeName; +AS_EXTERN NSString *const ASTextBackedStringAttributeName; /// The value of this attribute is a `ASTextBinding` object. /// Use this attribute to bind a range of text together, as if it was a single charactor. -UIKIT_EXTERN NSString *const ASTextBindingAttributeName; +AS_EXTERN NSString *const ASTextBindingAttributeName; /// The value of this attribute is a `ASTextShadow` object. /// Use this attribute to add shadow to a range of text. /// Shadow will be drawn below text glyphs. Use ASTextShadow.subShadow to add multi-shadow. -UIKIT_EXTERN NSString *const ASTextShadowAttributeName; +AS_EXTERN NSString *const ASTextShadowAttributeName; /// The value of this attribute is a `ASTextShadow` object. /// Use this attribute to add inner shadow to a range of text. /// Inner shadow will be drawn above text glyphs. Use ASTextShadow.subShadow to add multi-shadow. -UIKIT_EXTERN NSString *const ASTextInnerShadowAttributeName; +AS_EXTERN NSString *const ASTextInnerShadowAttributeName; /// The value of this attribute is a `ASTextDecoration` object. /// Use this attribute to add underline to a range of text. /// The underline will be drawn below text glyphs. -UIKIT_EXTERN NSString *const ASTextUnderlineAttributeName; +AS_EXTERN NSString *const ASTextUnderlineAttributeName; /// The value of this attribute is a `ASTextDecoration` object. /// Use this attribute to add strikethrough (delete line) to a range of text. /// The strikethrough will be drawn above text glyphs. -UIKIT_EXTERN NSString *const ASTextStrikethroughAttributeName; +AS_EXTERN NSString *const ASTextStrikethroughAttributeName; /// The value of this attribute is a `ASTextBorder` object. /// Use this attribute to add cover border or cover color to a range of text. /// The border will be drawn above the text glyphs. -UIKIT_EXTERN NSString *const ASTextBorderAttributeName; +AS_EXTERN NSString *const ASTextBorderAttributeName; /// The value of this attribute is a `ASTextBorder` object. /// Use this attribute to add background border or background color to a range of text. /// The border will be drawn below the text glyphs. -UIKIT_EXTERN NSString *const ASTextBackgroundBorderAttributeName; +AS_EXTERN NSString *const ASTextBackgroundBorderAttributeName; /// The value of this attribute is a `ASTextBorder` object. /// Use this attribute to add a code block border to one or more line of text. /// The border will be drawn below the text glyphs. -UIKIT_EXTERN NSString *const ASTextBlockBorderAttributeName; +AS_EXTERN NSString *const ASTextBlockBorderAttributeName; /// The value of this attribute is a `ASTextAttachment` object. /// Use this attribute to add attachment to text. /// It should be used in conjunction with a CTRunDelegate. -UIKIT_EXTERN NSString *const ASTextAttachmentAttributeName; +AS_EXTERN NSString *const ASTextAttachmentAttributeName; /// The value of this attribute is a `ASTextHighlight` object. /// Use this attribute to add a touchable highlight state to a range of text. -UIKIT_EXTERN NSString *const ASTextHighlightAttributeName; +AS_EXTERN NSString *const ASTextHighlightAttributeName; /// The value of this attribute is a `NSValue` object stores CGAffineTransform. /// Use this attribute to add transform to each glyph in a range of text. -UIKIT_EXTERN NSString *const ASTextGlyphTransformAttributeName; +AS_EXTERN NSString *const ASTextGlyphTransformAttributeName; #pragma mark - String Token Define -UIKIT_EXTERN NSString *const ASTextAttachmentToken; ///< Object replacement character (U+FFFC), used for text attachment. -UIKIT_EXTERN NSString *const ASTextTruncationToken; ///< Horizontal ellipsis (U+2026), used for text truncation "…". +AS_EXTERN NSString *const ASTextAttachmentToken; ///< Object replacement character (U+FFFC), used for text attachment. +AS_EXTERN NSString *const ASTextTruncationToken; ///< Horizontal ellipsis (U+2026), used for text truncation "…". diff --git a/Source/Private/_ASCollectionGalleryLayoutInfo.h b/Source/Private/_ASCollectionGalleryLayoutInfo.h index 72dfc7db..ff0d9aa4 100644 --- a/Source/Private/_ASCollectionGalleryLayoutInfo.h +++ b/Source/Private/_ASCollectionGalleryLayoutInfo.h @@ -12,6 +12,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface _ASCollectionGalleryLayoutInfo : NSObject // Read-only properties @@ -28,3 +30,5 @@ - (instancetype)init NS_UNAVAILABLE; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/Private/_ASCoreAnimationExtras.h b/Source/Private/_ASCoreAnimationExtras.h index 69c30539..b469a775 100644 --- a/Source/Private/_ASCoreAnimationExtras.h +++ b/Source/Private/_ASCoreAnimationExtras.h @@ -20,7 +20,6 @@ #import #import -ASDISPLAYNODE_EXTERN_C_BEGIN // This protocol defines the core properties that ASDisplayNode and CALayer share, for managing contents. @protocol ASResizableContents @@ -44,21 +43,21 @@ ASDISPLAYNODE_EXTERN_C_BEGIN @param obj ASDisplayNode, CALayer or object that conforms to `ASResizableContents` protocol @param image Image you would like to resize */ -extern void ASDisplayNodeSetResizableContents(id obj, UIImage *image); +AS_EXTERN void ASDisplayNodeSetResizableContents(id obj, UIImage *image); /** Turns a value of UIViewContentMode to a string for debugging or serialization @param contentMode Any of the UIViewContentMode constants @return A human-readable representation of the constant, or the integer value of the constant if not recognized. */ -extern NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode); +AS_EXTERN NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode); /** Turns a string representing a contentMode into a contentMode @param string Any of the strings in UIContentModeDescriptionLUT @return Any of the UIViewContentMode constants, or an int if the string is a number. If the string is not recognized, UIViewContentModeScaleToFill is returned. */ -extern UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string); +AS_EXTERN UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string); /** Maps a value of UIViewContentMode to a corresponding contentsGravity @@ -66,7 +65,7 @@ extern UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string @param contentMode A content mode except for UIViewContentModeRedraw, which has no corresponding contentsGravity (it corresponds to needsDisplayOnBoundsChange = YES) @return An NSString constant from the documentation, eg kCAGravityCenter... or nil if there is no corresponding contentsGravity. Will assert if contentMode is unknown. */ -extern NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode); +AS_EXTERN NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode); /** Maps a value of contentsGravity to a corresponding UIViewContentMode @@ -74,23 +73,21 @@ extern NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewCon @param contentsGravity A contents gravity @return A UIViewContentMode constant from UIView.h, eg UIViewContentModeCenter..., or UIViewContentModeScaleToFill if contentsGravity is not one of the CA constants. Will assert if the contentsGravity is unknown. */ -extern UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *const contentsGravity); +AS_EXTERN UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *const contentsGravity); /** Use this to create a stretchable appropriate to approximate a filled rectangle, but with antialiasing on the edges when not pixel-aligned. It's best to keep the layer this image is added to with contentsScale equal to the scale of the final transform to screen space so it is able to antialias appropriately even when you shrink or grow the layer. @param color the fill color to use in the center of the image @param innerSize Unfortunately, 4 seems to be the smallest inner size that works if you're applying this stretchable to a larger box, whereas it does not display correctly for larger boxes. Thus some adjustment is necessary for the size of box you're displaying. If you're showing a 1px horizontal line, pass 1 height and at least 4 width. 2px vertical line: 2px wide, 4px high. Passing an innerSize greater that you desire is wasteful */ -extern UIImage *ASDisplayNodeStretchableBoxContentsWithColor(UIColor *color, CGSize innerSize); +AS_EXTERN UIImage *ASDisplayNodeStretchableBoxContentsWithColor(UIColor *color, CGSize innerSize); /** Checks whether a layer has ongoing animations @param layer A layer to check if animations are ongoing @return YES if the layer has ongoing animations, otherwise NO */ -extern BOOL ASDisplayNodeLayerHasAnimations(CALayer *layer); +AS_EXTERN BOOL ASDisplayNodeLayerHasAnimations(CALayer *layer); // This function is a less generalized version of ASDisplayNodeSetResizableContents. -extern void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) ASDISPLAYNODE_DEPRECATED; - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) AS_DEPRECATED; diff --git a/Source/Private/_ASCoreAnimationExtras.mm b/Source/Private/_ASCoreAnimationExtras.mm index 65172962..353b1943 100644 --- a/Source/Private/_ASCoreAnimationExtras.mm +++ b/Source/Private/_ASCoreAnimationExtras.mm @@ -19,12 +19,12 @@ #import #import -extern void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) +AS_EXTERN void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) { ASDisplayNodeSetResizableContents(layer, image); } -extern void ASDisplayNodeSetResizableContents(id obj, UIImage *image) +AS_EXTERN void ASDisplayNodeSetResizableContents(id obj, UIImage *image) { if (image) { ASDisplayNodeCAssert(image.resizingMode == UIImageResizingModeStretch || UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero), @@ -98,9 +98,9 @@ static const struct _UIContentModeStringLUTEntry UIContentModeDescriptionLUT[] = NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode) { - for (int i=0; i< ARRAY_COUNT(UIContentModeDescriptionLUT); i++) { - if (UIContentModeDescriptionLUT[i].contentMode == contentMode) { - return UIContentModeDescriptionLUT[i].string; + for (auto &e : UIContentModeDescriptionLUT) { + if (e.contentMode == contentMode) { + return e.string; } } return [NSString stringWithFormat:@"%d", (int)contentMode]; @@ -108,9 +108,9 @@ NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode) UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string) { - for (int i=0; i < ARRAY_COUNT(UIContentModeDescriptionLUT); i++) { - if (ASObjectIsEqual(UIContentModeDescriptionLUT[i].string, string)) { - return UIContentModeDescriptionLUT[i].contentMode; + for (auto &e : UIContentModeDescriptionLUT) { + if (ASObjectIsEqual(e.string, string)) { + return e.contentMode; } } return UIViewContentModeScaleToFill; @@ -118,9 +118,9 @@ UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string) NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode) { - for (int i=0; i < ARRAY_COUNT(UIContentModeCAGravityLUT); i++) { - if (UIContentModeCAGravityLUT[i].contentMode == contentMode) { - return UIContentModeCAGravityLUT[i].string; + for (auto &e : UIContentModeCAGravityLUT) { + if (e.contentMode == contentMode) { + return e.string; } } ASDisplayNodeCAssert(contentMode == UIViewContentModeRedraw, @"Encountered an unknown contentMode %zd. Is this a new version of iOS?", contentMode); @@ -140,19 +140,17 @@ UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *cons return cachedModes[foundCacheIndex]; } - for (int i = 0; i < ARRAY_COUNT(UIContentModeCAGravityLUT); i++) { - if (ASObjectIsEqual(UIContentModeCAGravityLUT[i].string, contentsGravity)) { - UIViewContentMode foundContentMode = UIContentModeCAGravityLUT[i].contentMode; - + for (auto &e : UIContentModeCAGravityLUT) { + if (ASObjectIsEqual(e.string, contentsGravity)) { if (currentCacheIndex < ContentModeCacheSize) { // Cache the input value. This is almost always a different pointer than in our LUT and will frequently // be the same value for an overwhelming majority of inputs. [cachedStrings addObject:contentsGravity]; - cachedModes[currentCacheIndex] = foundContentMode; + cachedModes[currentCacheIndex] = e.contentMode; currentCacheIndex++; } - return foundContentMode; + return e.contentMode; } } diff --git a/Source/Private/_ASPendingState.mm b/Source/Private/_ASPendingState.mm index a87707bb..447b6608 100644 --- a/Source/Private/_ASPendingState.mm +++ b/Source/Private/_ASPendingState.mm @@ -161,7 +161,7 @@ typedef struct { * Note we can't read bounds and position in the background, so we have to keep the frame * value intact until application time (now). */ -ASDISPLAYNODE_INLINE void ASPendingStateApplyMetricsToLayer(_ASPendingState *state, CALayer *layer) { +AS_INLINE void ASPendingStateApplyMetricsToLayer(_ASPendingState *state, CALayer *layer) { ASPendingStateFlags flags = state->_flags; if (flags.setFrame) { CGRect _bounds = CGRectZero; diff --git a/Source/TextKit/ASTextKitAttributes.h b/Source/TextKit/ASTextKitAttributes.h index ee11fdde..6398c9f8 100755 --- a/Source/TextKit/ASTextKitAttributes.h +++ b/Source/TextKit/ASTextKitAttributes.h @@ -20,12 +20,12 @@ #import #import -extern NSString *const ASTextKitTruncationAttributeName; +AS_EXTERN NSString *const ASTextKitTruncationAttributeName; /** Use ASTextKitEntityAttribute as the value of this attribute to embed a link or other interactable content inside the text. */ -extern NSString *const ASTextKitEntityAttributeName; +AS_EXTERN NSString *const ASTextKitEntityAttributeName; /** All NSObject values in this struct should be copied when passed into the TextComponent. diff --git a/Source/TextKit/ASTextKitContext.h b/Source/TextKit/ASTextKitContext.h index 8de63a1b..39685d8e 100755 --- a/Source/TextKit/ASTextKitContext.h +++ b/Source/TextKit/ASTextKitContext.h @@ -47,8 +47,8 @@ AS_SUBCLASSING_RESTRICTED Callers MUST NOT keep a ref to these internal objects and use them later. This WILL cause crashes in your application. */ -- (void)performBlockWithLockedTextKitComponents:(AS_NOESCAPE void (^)(NSLayoutManager *layoutManager, - NSTextStorage *textStorage, - NSTextContainer *textContainer))block; +- (void)performBlockWithLockedTextKitComponents:(void (NS_NOESCAPE ^)(NSLayoutManager *layoutManager, + NSTextStorage *textStorage, + NSTextContainer *textContainer))block; @end diff --git a/Source/TextKit/ASTextKitCoreTextAdditions.h b/Source/TextKit/ASTextKitCoreTextAdditions.h index 211250e8..164ced2e 100644 --- a/Source/TextKit/ASTextKitCoreTextAdditions.h +++ b/Source/TextKit/ASTextKitCoreTextAdditions.h @@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN -ASDISPLAYNODE_EXTERN_C_BEGIN /** @abstract Returns whether a given attribute is an unsupported Core Text attribute. @param attributeName The name of the attribute @@ -40,8 +39,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN - kCTUnderlineColorAttributeName @result Whether attributeName is an unsupported Core Text attribute. */ -BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName); - +AS_EXTERN BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName); /** @abstract Returns an attributes dictionary for use by NSAttributedString, given a dictionary of Core Text attributes. @@ -60,16 +58,14 @@ BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName); - kCTUnderlineColorAttributeName @result An NSDictionary of attributes for use by NSAttributedString. */ -extern NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *coreTextAttributes); +AS_EXTERN NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *coreTextAttributes); /** @abstract Returns an NSAttributedString whose Core Text attributes have been converted, where possible, to NSAttributedString attributes. @param dirtyAttributedString An NSAttributedString that may contain Core Text attributes. @result An NSAttributedString that's preserved as many CFAttributedString attributes as possible. */ -extern NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedString *dirtyAttributedString); - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedString *dirtyAttributedString); #pragma mark - #pragma mark - @@ -88,7 +84,7 @@ ASDISPLAYNODE_EXTERN_C_END @result An NSParagraphStyle initialized with as many of the paragraph specifiers from `coreTextParagraphStyle` as possible. */ -+ (instancetype)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED; ++ (NSParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED; @end diff --git a/Tests/ASDisplayNodeTestsHelper.h b/Tests/ASDisplayNodeTestsHelper.h index 3e0bea5f..2d071bcf 100644 --- a/Tests/ASDisplayNodeTestsHelper.h +++ b/Tests/ASDisplayNodeTestsHelper.h @@ -22,12 +22,8 @@ typedef BOOL (^as_condition_block_t)(void); -ASDISPLAYNODE_EXTERN_C_BEGIN +AS_EXTERN BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block); -BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block); - -void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size); -void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange); -void ASCATransactionQueueWait(ASCATransactionQueue *q); // nil means shared queue - -ASDISPLAYNODE_EXTERN_C_END +AS_EXTERN void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size); +AS_EXTERN void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange); +AS_EXTERN void ASCATransactionQueueWait(ASCATransactionQueue *q); // nil means shared queue