diff --git a/Package.swift b/Package.swift index 358a30cab..d602da36f 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -42,8 +42,8 @@ let package = Package( name: "Texture", platforms: [ .macOS(.v10_15), - .iOS(.v10), - .tvOS(.v10), + .iOS(.v12), + .tvOS(.v12), ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. diff --git a/Source/ASCellNode.h b/Source/ASCellNode.h index 8328e59b4..f1b99fc27 100644 --- a/Source/ASCellNode.h +++ b/Source/ASCellNode.h @@ -49,7 +49,7 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { * calling `-setNeedsLayout` will also notify the collection on the main thread * so that the collection can update its item layout if the cell's size changed. */ -@interface ASCellNode : ASDisplayNode +NS_SWIFT_SENDABLE @interface ASCellNode : ASDisplayNode /** * @abstract When enabled, ensures that the cell is completely displayed before allowed onscreen. @@ -100,7 +100,7 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { * A Boolean value that is synchronized with the underlying collection or tableView cell property. * Setting this value is equivalent to calling highlightItem / unHighlightItem on the collection or table. */ -@property (getter=isHighlighted) BOOL highlighted; +@property (getter=isHighlighted) NS_SWIFT_UI_ACTOR BOOL highlighted; /** * The current index path of this cell node, or @c nil if this node is @@ -128,7 +128,7 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { * The backing view controller, or @c nil if the node wasn't initialized with backing view controller * @note This property must be accessed on the main thread. */ -@property (nullable, nonatomic, readonly) UIViewController *viewController; +@property (nullable, nonatomic, readonly) UIViewController *viewController NS_SWIFT_UI_ACTOR; /** diff --git a/Source/ASCollectionNode+Beta.h b/Source/ASCollectionNode+Beta.h index 7136fa914..9a05b3509 100644 --- a/Source/ASCollectionNode+Beta.h +++ b/Source/ASCollectionNode+Beta.h @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN /** * The elements that are currently displayed. The "UIKit index space". Must be accessed on main thread. */ -@property (nonatomic, readonly) ASElementMap *visibleElements; +@property (nonatomic, readonly) ASElementMap *visibleElements NS_SWIFT_UI_ACTOR; @property (nullable, readonly) id layoutDelegate; @@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN * * @default defaults to ASCellLayoutModeNone. */ -@property (nonatomic) ASCellLayoutMode cellLayoutMode; +@property (nonatomic) ASCellLayoutMode cellLayoutMode NS_SWIFT_UI_ACTOR; /** * Returns YES if the ASCollectionNode contents are completely synchronized with the underlying collection-view layout. @@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN * * When isSynchronized == YES, the block is run block immediately (before the method returns). */ -- (void)onDidFinishSynchronizing:(void (^)(void))didFinishSynchronizing; +- (void)onDidFinishSynchronizing:(void NS_SWIFT_UI_ACTOR (^)(void))didFinishSynchronizing; - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id)layoutFacilitator; diff --git a/Source/ASCollectionNode.h b/Source/ASCollectionNode.h index 2c9c729f0..a61b04105 100644 --- a/Source/ASCollectionNode.h +++ b/Source/ASCollectionNode.h @@ -231,7 +231,7 @@ NS_ASSUME_NONNULL_BEGIN * * This method must be called on the main thread. */ -- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated; +- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated NS_SWIFT_UI_ACTOR; /** * Determines collection node's current scroll direction. Supports 2-axis collection nodes. @@ -271,7 +271,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 AS_NOESCAPE void (^)(void))updates completion:(nullable NS_SWIFT_UI_ACTOR void (^)(BOOL finished))completion NS_SWIFT_UI_ACTOR; /** * Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. @@ -282,7 +282,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 AS_NOESCAPE void (^)(void))updates completion:(nullable NS_SWIFT_UI_ACTOR void (^)(BOOL finished))completion NS_SWIFT_UI_ACTOR; /** * Returns YES if the ASCollectionNode is still processing changes from performBatchUpdates:. @@ -311,12 +311,12 @@ NS_ASSUME_NONNULL_BEGIN * * Calling -waitUntilAllUpdatesAreProcessed is one way to flush any pending update completion blocks. */ -- (void)onDidFinishProcessingUpdates:(void (^)(void))didFinishProcessingUpdates; +- (void)onDidFinishProcessingUpdates:(void (NS_SWIFT_UI_ACTOR ^)(void))didFinishProcessingUpdates; /** * Blocks execution of the main thread until all section and item updates are committed to the view. This method must be called from the main thread. */ -- (void)waitUntilAllUpdatesAreProcessed; +- (void)waitUntilAllUpdatesAreProcessed NS_SWIFT_UI_ACTOR; /** * Inserts one or more sections. @@ -326,7 +326,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes * before this method is called. */ -- (void)insertSections:(NSIndexSet *)sections; +- (void)insertSections:(NSIndexSet *)sections NS_SWIFT_UI_ACTOR; /** * Deletes one or more sections. @@ -336,7 +336,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes * before this method is called. */ -- (void)deleteSections:(NSIndexSet *)sections; +- (void)deleteSections:(NSIndexSet *)sections NS_SWIFT_UI_ACTOR; /** * Reloads the specified sections. @@ -346,7 +346,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes * before this method is called. */ -- (void)reloadSections:(NSIndexSet *)sections; +- (void)reloadSections:(NSIndexSet *)sections NS_SWIFT_UI_ACTOR; /** * Moves a section to a new location. @@ -358,7 +358,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes * before this method is called. */ -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection; +- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection NS_SWIFT_UI_ACTOR; /** * Inserts items at the locations identified by an array of index paths. @@ -368,7 +368,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes * before this method is called. */ -- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths; +- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths NS_SWIFT_UI_ACTOR; /** * Deletes the items specified by an array of index paths. @@ -378,7 +378,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes * before this method is called. */ -- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths; +- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths NS_SWIFT_UI_ACTOR; /** * Reloads the specified items. @@ -388,7 +388,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes * before this method is called. */ -- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths; +- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths NS_SWIFT_UI_ACTOR; /** * Moves the item at a specified location to a destination location. @@ -400,7 +400,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes * before this method is called. */ -- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; +- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath NS_SWIFT_UI_ACTOR; /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -409,7 +409,7 @@ NS_ASSUME_NONNULL_BEGIN * the main thread. * @warning This method is substantially more expensive than UICollectionView's version. */ -- (void)reloadDataWithCompletion:(nullable void (^)(void))completion; +- (void)reloadDataWithCompletion:(nullable NS_SWIFT_UI_ACTOR void (^)(void))completion NS_SWIFT_UI_ACTOR; /** @@ -446,7 +446,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion This method must be called from the main thread. */ -- (void)selectItemAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition; +- (void)selectItemAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition NS_SWIFT_UI_ACTOR; /** * Deselects the item at the specified index. @@ -459,7 +459,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion This method must be called from the main thread. */ -- (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated; +- (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated NS_SWIFT_UI_ACTOR; #pragma mark - Querying Data @@ -482,7 +482,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return an array containing the nodes being displayed on screen. This must be called on the main thread. */ -@property (nonatomic, readonly) NSArray<__kindof ASCellNode *> *visibleNodes; +@property (nonatomic, readonly) NSArray<__kindof ASCellNode *> *visibleNodes NS_SWIFT_UI_ACTOR; /** * Retrieves the node for the item at the given index path. @@ -518,7 +518,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return an array containing the index paths of all visible items. This must be called on the main thread. */ -@property (nonatomic, readonly) NSArray *indexPathsForVisibleItems; +@property (nonatomic, readonly) NSArray *indexPathsForVisibleItems NS_SWIFT_UI_ACTOR; /** * Retrieve the index path of the item at the given point. @@ -536,7 +536,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return The cell for the given index path. This must be called on the main thread. */ -- (nullable UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath; +- (nullable UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath NS_SWIFT_UI_ACTOR; /** * Retrieves the context object for the given section, as provided by the data source in @@ -603,7 +603,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)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath; +- (NS_SWIFT_SENDABLE ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath; /** * Similar to -collectionView:cellForItemAtIndexPath:. @@ -615,7 +615,7 @@ NS_ASSUME_NONNULL_BEGIN * not implement reuse (it will be called once per item). Unlike UICollectionView's version, * this method is not called when the item is about to display. */ -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForItemAtIndexPath:(NSIndexPath *)indexPath; +- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForItemAtIndexPath:(NSIndexPath *)indexPath NS_SWIFT_UI_ACTOR; /** * Asks the data source to provide a node-block to display for the given supplementary element in the collection view. @@ -717,7 +717,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead.") NS_SWIFT_UI_ACTOR; /** * Similar to -collectionView:nodeForItemAtIndexPath: @@ -750,7 +750,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 ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called.") NS_SWIFT_UI_ACTOR; /** * Indicator to unlock the data source for data fetching in async mode. @@ -760,7 +760,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 ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called.") NS_SWIFT_UI_ACTOR; @end diff --git a/Source/ASCollectionView.h b/Source/ASCollectionView.h index e99d8e295..66dc545cc 100644 --- a/Source/ASCollectionView.h +++ b/Source/ASCollectionView.h @@ -79,7 +79,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return The context object, or @c nil if no context was provided. */ -- (nullable id)contextForSection:(NSInteger)section AS_WARN_UNUSED_RESULT; +- (nullable id)contextForSection:(NSInteger)section AS_WARN_UNUSED_RESULT NS_SWIFT_UI_ACTOR; @end @@ -248,7 +248,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 AS_NOESCAPE void (^)(void))updates completion:(nullable NS_SWIFT_UI_ACTOR void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Perform a batch of updates asynchronously. This method must be called from the main thread. @@ -259,7 +259,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 AS_NOESCAPE void (^)(void))updates completion:(nullable NS_SWIFT_UI_ACTOR void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -268,7 +268,7 @@ 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 NS_SWIFT_UI_ACTOR void (^)(void))completion AS_UNAVAILABLE("Use ASCollectionNode method instead."); /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -317,7 +317,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Deletes one or more sections. @@ -327,7 +327,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Reloads the specified sections. @@ -337,7 +337,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Moves a section to a new location. @@ -349,7 +349,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Inserts items at the locations identified by an array of index paths. @@ -359,7 +359,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Deletes the items specified by an array of index paths. @@ -369,7 +369,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Reloads the specified items. @@ -379,7 +379,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Moves the item at a specified location to a destination location. @@ -391,7 +391,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 ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead.") NS_SWIFT_UI_ACTOR; /** * Query the sized node at @c indexPath for its calculatedSize. diff --git a/Source/ASControlNode.h b/Source/ASControlNode.h index 9506c41d0..0e3c02fbc 100644 --- a/Source/ASControlNode.h +++ b/Source/ASControlNode.h @@ -74,7 +74,7 @@ static UIControlState const ASControlStateSelected ASDISPLAYNODE_DEPRECATED_MSG( @abstract Indicates whether or not the receiver is highlighted. @discussion This is set automatically when the there is a touch inside the control and removed on exit or touch up. This is different from touchInside in that it includes an area around the control, rather than just for touches inside the control. */ -@property (getter=isHighlighted) BOOL highlighted; +@property (getter=isHighlighted) NS_SWIFT_UI_ACTOR BOOL highlighted; /** @abstract Indicates whether or not the receiver is highlighted. diff --git a/Source/ASDisplayNode+Beta.h b/Source/ASDisplayNode+Beta.h index 585175a2c..a77c7434c 100644 --- a/Source/ASDisplayNode+Beta.h +++ b/Source/ASDisplayNode+Beta.h @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN -ASDK_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); +ASDK_EXTERN void ASPerformBlockOnMainThread(void NS_SWIFT_UI_ACTOR (^block)(void)); ASDK_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT /** diff --git a/Source/ASDisplayNode+Convenience.h b/Source/ASDisplayNode+Convenience.h index 7c8d6d59b..341dbc44e 100644 --- a/Source/ASDisplayNode+Convenience.h +++ b/Source/ASDisplayNode+Convenience.h @@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN * @warning This property may only be accessed on the main thread. This property may * be @c nil until the node's view is actually hosted in the view hierarchy. */ -@property (nonatomic, nullable, readonly) __kindof UIViewController *closestViewController; +@property (nonatomic, nullable, readonly) NS_SWIFT_UI_ACTOR __kindof UIViewController *closestViewController; @end diff --git a/Source/ASDisplayNode+InterfaceState.h b/Source/ASDisplayNode+InterfaceState.h index 96ff70322..f994cc9c9 100644 --- a/Source/ASDisplayNode+InterfaceState.h +++ b/Source/ASDisplayNode+InterfaceState.h @@ -53,56 +53,56 @@ typedef NS_OPTIONS(unsigned char, ASInterfaceState) * @discussion Subclasses may use this to monitor when they become visible. * @note This method is guaranteed to be called on main. */ -- (void)didEnterVisibleState; +- (void)didEnterVisibleState NS_SWIFT_UI_ACTOR; /** * @abstract Called whenever the node is no longer visible. * @discussion Subclasses may use this to monitor when they are no longer visible. * @note This method is guaranteed to be called on main. */ -- (void)didExitVisibleState; +- (void)didExitVisibleState NS_SWIFT_UI_ACTOR; /** * @abstract Called whenever the the node has entered the display state. * @discussion Subclasses may use this to monitor when a node should be rendering its content. * @note This method is guaranteed to be called on main. */ -- (void)didEnterDisplayState; +- (void)didEnterDisplayState NS_SWIFT_UI_ACTOR; /** * @abstract Called whenever the the node has exited the display state. * @discussion Subclasses may use this to monitor when a node should no longer be rendering its content. * @note This method is guaranteed to be called on main. */ -- (void)didExitDisplayState; +- (void)didExitDisplayState NS_SWIFT_UI_ACTOR; /** * @abstract Called whenever the the node has entered the preload state. * @discussion Subclasses may use this to monitor data for a node should be preloaded, either from a local or remote source. * @note This method is guaranteed to be called on main. */ -- (void)didEnterPreloadState; +- (void)didEnterPreloadState NS_SWIFT_UI_ACTOR; /** * @abstract Called whenever the the node has exited the preload state. * @discussion Subclasses may use this to monitor whether preloading data for a node should be canceled. * @note This method is guaranteed to be called on main. */ -- (void)didExitPreloadState; +- (void)didExitPreloadState NS_SWIFT_UI_ACTOR; /** * @abstract Called when the node has completed applying the layout. * @discussion Can be used for operations that are performed after layout has completed. * @note This method is guaranteed to be called on main. */ -- (void)nodeDidLayout; +- (void)nodeDidLayout NS_SWIFT_UI_ACTOR; /** * @abstract Called when the node loads. * @discussion Can be used for operations that are performed after the node's view is available. * @note This method is guaranteed to be called on main. */ -- (void)nodeDidLoad; +- (void)nodeDidLoad NS_SWIFT_UI_ACTOR; /** * @abstract Indicates that the receiver and all subnodes have finished displaying. @@ -114,7 +114,7 @@ typedef NS_OPTIONS(unsigned char, ASInterfaceState) * the progressImage block. * @note This method is guaranteed to be called on main. */ -- (void)hierarchyDisplayDidFinish; +- (void)hierarchyDisplayDidFinish NS_SWIFT_UI_ACTOR; @optional /** @@ -134,7 +134,7 @@ typedef NS_OPTIONS(unsigned char, ASInterfaceState) * re-parented multiple times, and each time will trigger this call. * @note This method is guaranteed to be called on main. */ -- (void)didEnterHierarchy; +- (void)didEnterHierarchy NS_SWIFT_UI_ACTOR; /** * @abstract Called when the node's layer has exited the hierarchy. @@ -143,6 +143,6 @@ typedef NS_OPTIONS(unsigned char, ASInterfaceState) * re-parented multiple times, and each time will trigger this call. * @note This method is guaranteed to be called on main. */ -- (void)didExitHierarchy; +- (void)didExitHierarchy NS_SWIFT_UI_ACTOR; @end diff --git a/Source/ASDisplayNode+Subclasses.h b/Source/ASDisplayNode+Subclasses.h index 3f4a59b30..48eb24daa 100644 --- a/Source/ASDisplayNode+Subclasses.h +++ b/Source/ASDisplayNode+Subclasses.h @@ -71,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN * @discussion This is the best time to add gesture recognizers to the view. */ AS_CATEGORY_IMPLEMENTABLE -- (void)didLoad ASDISPLAYNODE_REQUIRES_SUPER; +- (void)didLoad ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * An empty method that you can implement in a category to add global @@ -95,7 +95,7 @@ AS_CATEGORY_IMPLEMENTABLE * * @discussion Subclasses override this method to layout all subnodes or subviews. */ -- (void)layout ASDISPLAYNODE_REQUIRES_SUPER; +- (void)layout ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * @abstract Called on the main thread by the view's -layoutSubviews, after -layout. @@ -104,7 +104,8 @@ AS_CATEGORY_IMPLEMENTABLE * out. */ AS_CATEGORY_IMPLEMENTABLE -- (void)layoutDidFinish ASDISPLAYNODE_REQUIRES_SUPER; + +- (void)layoutDidFinish ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * @abstract Called on a background thread if !isNodeLoaded - called on the main thread if isNodeLoaded. @@ -255,7 +256,8 @@ AS_CATEGORY_IMPLEMENTABLE * * @note Called on the main thread only */ -- (nullable id)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer; + +- (nullable id)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer NS_SWIFT_UI_ACTOR; /** * @abstract Indicates that the receiver is about to display. @@ -267,7 +269,8 @@ AS_CATEGORY_IMPLEMENTABLE * * @note Called on the main thread only */ -- (void)displayWillStart ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use displayWillStartAsynchronously: instead."); + +- (void)displayWillStart ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use displayWillStartAsynchronously: instead.") NS_SWIFT_UI_ACTOR; /** * @abstract Indicates that the receiver is about to display. @@ -277,7 +280,8 @@ AS_CATEGORY_IMPLEMENTABLE * * @note Called on the main thread only */ -- (void)displayWillStartAsynchronously:(BOOL)asynchronously ASDISPLAYNODE_REQUIRES_SUPER; + +- (NS_SWIFT_UI_ACTOR void)displayWillStartAsynchronously:(BOOL)asynchronously ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * @abstract Indicates that the receiver has finished displaying. @@ -287,7 +291,7 @@ AS_CATEGORY_IMPLEMENTABLE * * @note Called on the main thread only */ -- (void)displayDidFinish ASDISPLAYNODE_REQUIRES_SUPER; +- (void)displayDidFinish ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * Called just before the view is added to a window. @@ -303,7 +307,7 @@ AS_CATEGORY_IMPLEMENTABLE * 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 ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * @abstract Whether the view or layer of this display node is currently in a window @@ -317,7 +321,7 @@ AS_CATEGORY_IMPLEMENTABLE * @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 ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * @abstract Indicates that the receiver is about to display its subnodes. This method is not called if there are no @@ -396,7 +400,7 @@ AS_CATEGORY_IMPLEMENTABLE * @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 ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * @abstract Tells the node when touches moved in its view. @@ -404,7 +408,7 @@ AS_CATEGORY_IMPLEMENTABLE * @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 ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * @abstract Tells the node when touches ended in its view. @@ -412,7 +416,7 @@ AS_CATEGORY_IMPLEMENTABLE * @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 ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; /** * @abstract Tells the node when touches was cancelled in its view. @@ -420,7 +424,7 @@ AS_CATEGORY_IMPLEMENTABLE * @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 ASDISPLAYNODE_REQUIRES_SUPER NS_SWIFT_UI_ACTOR; #pragma mark - Managing Gesture Recognizers @@ -451,7 +455,7 @@ AS_CATEGORY_IMPLEMENTABLE * 1) allows sending events to plain UIViews that don't have attached nodes, * 2) hitTest: is never called before the views are created. */ -- (nullable UIView *)hitTest:(CGPoint)point withEvent:(nullable UIEvent *)event; +- (nullable UIView *)hitTest:(CGPoint)point withEvent:(nullable UIEvent *)event NS_SWIFT_UI_ACTOR; #pragma mark - Placeholders diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index 443f633c1..46fdddb83 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN /** * UIView creation block. Used to create the backing view of a new display node. */ -typedef UIView * _Nonnull(^ASDisplayNodeViewBlock)(void); +typedef NS_SWIFT_UI_ACTOR UIView * _Nonnull(NS_SWIFT_UI_ACTOR ^ASDisplayNodeViewBlock) (void); /** * UIView creation block. Used to create the backing view of a new display node. @@ -49,7 +49,7 @@ typedef CALayer * _Nonnull(^ASDisplayNodeLayerBlock)(void); /** * ASDisplayNode loaded callback block. This block is called BEFORE the -didLoad method and is always called on the main thread. */ -typedef void (^ASDisplayNodeDidLoadBlock)(__kindof ASDisplayNode * node); +typedef void (NS_SWIFT_UI_ACTOR ^ASDisplayNodeDidLoadBlock)(__kindof ASDisplayNode * node); /** * ASDisplayNode will / did render node content in context. @@ -124,7 +124,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * @return An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main * queue. The view will render synchronously and -layout and touch handling methods on the node will not be called. */ -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock; +- (instancetype)initWithViewBlock:(NS_SWIFT_UI_ACTOR ASDisplayNodeViewBlock)viewBlock; /** * @abstract Alternative initializer with a block to create the backing view. @@ -135,7 +135,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * @return An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main * queue. The view will render synchronously and -layout and touch handling methods on the node will not be called. */ -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock; +- (instancetype)initWithViewBlock:(NS_SWIFT_UI_ACTOR ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable NS_SWIFT_UI_ACTOR ASDisplayNodeDidLoadBlock)didLoadBlock; /** * @abstract Alternative initializer with a block to create the backing layer. @@ -145,7 +145,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * @return An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main * queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called. */ -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock; +- (instancetype)initWithLayerBlock:(NS_SWIFT_UI_ACTOR ASDisplayNodeLayerBlock)layerBlock; /** * @abstract Alternative initializer with a block to create the backing layer. @@ -156,7 +156,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * @return An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main * queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called. */ -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock; +- (instancetype)initWithLayerBlock:(NS_SWIFT_UI_ACTOR ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(nullable NS_SWIFT_UI_ACTOR ASDisplayNodeDidLoadBlock)didLoadBlock; /** * @abstract Add a block of work to be performed on the main thread when the node's view or layer is loaded. Thread safe. @@ -167,7 +167,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * * @precondition The node is not already loaded. */ -- (void)onDidLoad:(ASDisplayNodeDidLoadBlock)body; +- (void)onDidLoad:(NS_SWIFT_UI_ACTOR ASDisplayNodeDidLoadBlock)body; /** * Set the block that should be used to load this node's view. @@ -178,7 +178,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * * @note You will usually NOT call this. See the limitations documented in @c initWithViewBlock: */ -- (void)setViewBlock:(ASDisplayNodeViewBlock)viewBlock; +- (void)setViewBlock:(NS_SWIFT_UI_ACTOR ASDisplayNodeViewBlock)viewBlock; /** * Set the block that should be used to load this node's layer. @@ -209,7 +209,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * @warning The first access to it must be on the main thread, and should only be used on the main thread thereafter as * well. */ -@property (readonly) UIView *view; +@property (readonly) NS_SWIFT_UI_ACTOR UIView *view; /** * @abstract Returns whether a node's backing view or layer is loaded. @@ -234,7 +234,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * @warning The first access to it must be on the main thread, and should only be used on the main thread thereafter as * well. */ -@property (readonly) CALayer * layer; +@property (readonly) NS_SWIFT_UI_ACTOR CALayer * layer; /** * Returns YES if the node is – at least partially – visible in a window. @@ -275,7 +275,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * * @see ASInterfaceState */ -- (void)addInterfaceStateDelegate:(id )interfaceStateDelegate; +- (NS_SWIFT_UI_ACTOR void)addInterfaceStateDelegate:(id )interfaceStateDelegate; /** * @abstract Removes a delegate from receiving notifications on interfaceState changes. @@ -284,7 +284,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; * * @see ASInterfaceState */ -- (void)removeInterfaceStateDelegate:(id )interfaceStateDelegate; +- (NS_SWIFT_UI_ACTOR void)removeInterfaceStateDelegate:(id )interfaceStateDelegate; /** * @abstract Class property that allows to set a block that can be called on non-fatal errors. This @@ -764,7 +764,7 @@ ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; */ @property (readonly) UIEdgeInsets safeAreaInsets; @property BOOL insetsLayoutMarginsFromSafeArea; // Default: YES -- (void)safeAreaInsetsDidChange; +- (void)safeAreaInsetsDidChange NS_SWIFT_UI_ACTOR; // UIResponder methods @@ -920,7 +920,7 @@ typedef NS_ENUM(NSInteger, ASLayoutEngineType) { - (void)transitionLayoutWithSizeRange:(ASSizeRange)constrainedSize animated:(BOOL)animated shouldMeasureAsync:(BOOL)shouldMeasureAsync - measurementCompletion:(nullable void(^)(void))completion; + measurementCompletion:(nullable NS_SWIFT_UI_ACTOR void(^)(void))completion NS_SWIFT_UI_ACTOR; /** @@ -937,7 +937,7 @@ typedef NS_ENUM(NSInteger, ASLayoutEngineType) { */ - (void)transitionLayoutWithAnimation:(BOOL)animated shouldMeasureAsync:(BOOL)shouldMeasureAsync - measurementCompletion:(nullable void(^)(void))completion; + measurementCompletion:(nullable void(^)(void))completion NS_SWIFT_UI_ACTOR; /** * @abstract Cancels all performing layout transitions. Can be called on any thread. diff --git a/Source/ASEditableTextNode.h b/Source/ASEditableTextNode.h index 4ba4c96f1..571927c24 100644 --- a/Source/ASEditableTextNode.h +++ b/Source/ASEditableTextNode.h @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN @abstract Access to underlying UITextView for more configuration options. @warning This property should only be used on the main thread and should not be accessed before the editable text node's view is created. */ -@property (nonatomic, readonly) UITextView *textView; +@property (nonatomic, readonly) UITextView NS_SWIFT_UI_ACTOR *textView; //! @abstract The attributes to apply to new text being entered by the user. @property (nullable, nonatomic, copy) NSDictionary *typingAttributes; diff --git a/Source/ASNetworkImageNode.h b/Source/ASNetworkImageNode.h index 0c8c80a2c..8c1d81dd2 100644 --- a/Source/ASNetworkImageNode.h +++ b/Source/ASNetworkImageNode.h @@ -165,7 +165,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion Called on the main thread. */ -- (void)imageNodeDidStartFetchingData:(ASNetworkImageNode *)imageNode; +- (void)imageNodeDidStartFetchingData:(ASNetworkImageNode *)imageNode NS_SWIFT_UI_ACTOR; /** * Notification that the image node will load image from cache @@ -174,7 +174,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion Called on the main thread. */ -- (void)imageNodeWillLoadImageFromCache:(ASNetworkImageNode *)imageNode; +- (void)imageNodeWillLoadImageFromCache:(ASNetworkImageNode *)imageNode NS_SWIFT_UI_ACTOR; /** * Notification that the image node finished loading image from cache @@ -183,7 +183,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion Called on the main thread. */ -- (void)imageNodeDidLoadImageFromCache:(ASNetworkImageNode *)imageNode; +- (void)imageNodeDidLoadImageFromCache:(ASNetworkImageNode *)imageNode NS_SWIFT_UI_ACTOR; /** * Notification that the image node failed to load image from cache @@ -192,7 +192,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion Called on the main thread. */ -- (void)imageNodeDidFailToLoadImageFromCache:(ASNetworkImageNode *)imageNode; +- (void)imageNodeDidFailToLoadImageFromCache:(ASNetworkImageNode *)imageNode NS_SWIFT_UI_ACTOR; /** * Notification that the image node will load image from network @@ -201,7 +201,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion Called on the main thread. */ -- (void)imageNodeWillLoadImageFromNetwork:(ASNetworkImageNode *)imageNode; +- (void)imageNodeWillLoadImageFromNetwork:(ASNetworkImageNode *)imageNode NS_SWIFT_UI_ACTOR; /** * Notification that the image node will start display @@ -210,7 +210,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion Called on the main thread. */ -- (void)imageNodeWillStartDisplayAsynchronously:(ASNetworkImageNode *)imageNode; +- (void)imageNodeWillStartDisplayAsynchronously:(ASNetworkImageNode *)imageNode NS_SWIFT_UI_ACTOR; /** * Notification that the image node finished downloading an image, with additional info. @@ -251,7 +251,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discussion Called on the main thread. */ -- (void)imageNodeDidFinishDecoding:(ASNetworkImageNode *)imageNode; +- (void)imageNodeDidFinishDecoding:(ASNetworkImageNode *)imageNode NS_SWIFT_UI_ACTOR; @end diff --git a/Source/ASPagerNode.h b/Source/ASPagerNode.h index b8cd9c1fe..a3b1013b6 100644 --- a/Source/ASPagerNode.h +++ b/Source/ASPagerNode.h @@ -93,7 +93,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Returns the current page index. Main thread only. */ -@property (nonatomic, readonly) NSInteger currentPageIndex; +@property (nonatomic, readonly) NSInteger currentPageIndex NS_SWIFT_UI_ACTOR; /** * Scroll the contents of the receiver to ensure that the page is visible diff --git a/Source/ASSectionController.h b/Source/ASSectionController.h index 01f07dc17..c661c5f98 100644 --- a/Source/ASSectionController.h +++ b/Source/ASSectionController.h @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN * not implement reuse (it will be called once per item). Unlike UICollectionView's version, * this method is not called when the item is about to display. */ -- (ASCellNode *)nodeForItemAtIndex:(NSInteger)index; +- (ASCellNode *)nodeForItemAtIndex:(NSInteger)index NS_SWIFT_UI_ACTOR; /** * Asks the section controller whether it should batch fetch because the user is diff --git a/Source/ASTableNode.h b/Source/ASTableNode.h index 345c9c618..c615263b0 100644 --- a/Source/ASTableNode.h +++ b/Source/ASTableNode.h @@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN * * This method must be called on the main thread. */ -- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated; +- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated NS_SWIFT_UI_ACTOR; /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -170,7 +170,7 @@ NS_ASSUME_NONNULL_BEGIN * the main thread. * @warning This method is substantially more expensive than UITableView's version. */ -- (void)reloadDataWithCompletion:(nullable void (^)(void))completion; +- (void)reloadDataWithCompletion:(nullable NS_SWIFT_UI_ACTOR void (^)(void))completion; /** * Reload everything from scratch, destroying the working range and all cached nodes. diff --git a/Source/Debug/AsyncDisplayKit+Tips.h b/Source/Debug/AsyncDisplayKit+Tips.h index 35e95ff45..8bfe0f081 100644 --- a/Source/Debug/AsyncDisplayKit+Tips.h +++ b/Source/Debug/AsyncDisplayKit+Tips.h @@ -36,7 +36,7 @@ typedef void(^ASTipDisplayBlock)(ASDisplayNode *node, NSString *message); * If nil, the default, the message is just logged to the console with the * ancestry of the node. */ -@property (class, nonatomic, null_resettable) ASTipDisplayBlock tipDisplayBlock; +@property (class, nonatomic, null_resettable) NS_SWIFT_UI_ACTOR ASTipDisplayBlock tipDisplayBlock; @end diff --git a/Source/Details/ASCollectionGalleryLayoutDelegate.h b/Source/Details/ASCollectionGalleryLayoutDelegate.h index 159450c95..89d582af5 100644 --- a/Source/Details/ASCollectionGalleryLayoutDelegate.h +++ b/Source/Details/ASCollectionGalleryLayoutDelegate.h @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return The elements' size */ -- (CGSize)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate sizeForElements:(ASElementMap *)elements; +- (CGSize)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate sizeForElements:(ASElementMap *)elements NS_SWIFT_UI_ACTOR; @optional @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return The interitem spacing */ -- (CGFloat)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate minimumLineSpacingForElements:(ASElementMap *)elements; +- (CGFloat)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate minimumLineSpacingForElements:(ASElementMap *)elements NS_SWIFT_UI_ACTOR; /** * Returns the minumum spacing to use between items in the same row or column, depending on the scroll directions. @@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return The interitem spacing */ -- (CGFloat)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate minimumInteritemSpacingForElements:(ASElementMap *)elements; +- (CGFloat)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate minimumInteritemSpacingForElements:(ASElementMap *)elements NS_SWIFT_UI_ACTOR; /** * Returns the margins of each section. @@ -78,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return The margins used to layout content in a section */ -- (UIEdgeInsets)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate sectionInsetForElements:(ASElementMap *)elements; +- (UIEdgeInsets)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate sectionInsetForElements:(ASElementMap *)elements NS_SWIFT_UI_ACTOR; @end diff --git a/Source/Details/ASCollectionLayoutDelegate.h b/Source/Details/ASCollectionLayoutDelegate.h index debba275b..1ef6d36f1 100644 --- a/Source/Details/ASCollectionLayoutDelegate.h +++ b/Source/Details/ASCollectionLayoutDelegate.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN * * @discusstion This method will be called on main thread. */ -- (ASScrollDirection)scrollableDirections; +- (ASScrollDirection)scrollableDirections NS_SWIFT_UI_ACTOR; /** * @abstract Returns any additional information needed for a coming layout pass (@see @c -calculateLayoutWithContext:) with the given elements. @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN * * This method will be called on main thread. */ -- (nullable id)additionalInfoForLayoutWithElements:(ASElementMap *)elements; +- (nullable id)additionalInfoForLayoutWithElements:(ASElementMap *)elements NS_SWIFT_UI_ACTOR; /** * @abstract Prepares and returns a new layout for given context. diff --git a/Source/Details/ASDataController.h b/Source/Details/ASDataController.h index e8c08b9ea..a721b9827 100644 --- a/Source/Details/ASDataController.h +++ b/Source/Details/ASDataController.h @@ -128,7 +128,7 @@ ASDK_EXTERN NSString * const ASCollectionInvalidUpdateException; * * @discussion This method will be called on main thread. */ -- (ASCollectionLayoutContext *)layoutContextWithElements:(ASElementMap *)elements; +- (ASCollectionLayoutContext *)layoutContextWithElements:(ASElementMap *)elements NS_SWIFT_UI_ACTOR; /** * @abstract Prepares and returns a new layout for given context. @@ -174,14 +174,14 @@ ASDK_EXTERN NSString * const ASCollectionInvalidUpdateException; * * This property will only be changed on the main thread. */ -@property (copy, readonly) ASElementMap *visibleMap; +@property (copy, readonly) ASElementMap *visibleMap NS_SWIFT_UI_ACTOR; /** * The latest map fetched from the data source. May be more recent than @c visibleMap. * * This property will only be changed on the main thread. */ -@property (copy, readonly) ASElementMap *pendingMap; +@property (copy, readonly) ASElementMap *pendingMap NS_SWIFT_UI_ACTOR; /** Data source for fetching data info. @@ -201,7 +201,7 @@ ASDK_EXTERN NSString * const ASCollectionInvalidUpdateException; /** * Delegate for preparing layouts. Main thead only. */ -@property (nonatomic, weak) id layoutDelegate; +@property (nonatomic, weak) id NS_SWIFT_UI_ACTOR layoutDelegate; #ifdef __cplusplus /** @@ -210,7 +210,7 @@ ASDK_EXTERN NSString * const ASCollectionInvalidUpdateException; * * This must be called on the main thread. */ -- (std::vector)itemCountsFromDataSource; +- (std::vector)itemCountsFromDataSource NS_SWIFT_UI_ACTOR; #endif /** @@ -220,7 +220,7 @@ ASDK_EXTERN NSString * const ASCollectionInvalidUpdateException; * * This must be called on the main thread. */ -@property (nonatomic, readonly) BOOL initialReloadDataHasBeenCalled; +@property (nonatomic, readonly) BOOL NS_SWIFT_UI_ACTOR initialReloadDataHasBeenCalled; /** @name Data Updating */ diff --git a/Source/Details/ASDataController.mm b/Source/Details/ASDataController.mm index 83b3038dc..16ecfd0ed 100644 --- a/Source/Details/ASDataController.mm +++ b/Source/Details/ASDataController.mm @@ -30,6 +30,9 @@ #import "ASDisplayNode+Subclasses.h" #import "NSIndexSet+ASHelpers.h" +#import "ASCollectionView.h" +#import "ASAssert.h" + //#define LOG(...) NSLog(__VA_ARGS__) #define LOG(...) @@ -197,8 +200,26 @@ - (void)_layoutNode:(ASCellNode *)node withConstrainedSize:(ASSizeRange)constrai if (![_dataSource dataController:self shouldEagerlyLayoutNode:node]) { return; } - - ASDisplayNodeAssert(ASSizeRangeHasSignificantArea(constrainedSize), @"Attempt to layout cell node with invalid size range %@", NSStringFromASSizeRange(constrainedSize)); + + if (ASSizeRangeHasSignificantArea(constrainedSize) == NO) { + + ASPushMainThreadAssertionsDisabled(); + NSString *message = @""; + message = [message stringByAppendingString: @"Attempt to layout cell node with invalid size range."]; + message = [message stringByAppendingFormat: @"range: %@", NSStringFromASSizeRange(constrainedSize)]; + message = [message stringByAppendingFormat: @"layoutDelegate: %@", self.layoutDelegate]; + message = [message stringByAppendingFormat: @"node: %@", self.node]; + message = [message stringByAppendingFormat: @"delegate: %@", self.delegate]; + message = [message stringByAppendingFormat: @"dataSource: %@", self.dataSource]; + + if ([self.layoutDelegate isKindOfClass:[ASCollectionView class]]) { + ASCollectionView *collectionView = (ASCollectionView *) self.layoutDelegate; + message = [message stringByAppendingFormat: @"ASCollectionNode: %@", collectionView.collectionNode]; + } + + ASPopMainThreadAssertionsDisabled(); + ASDisplayNodeFailAssert(message); + } CGRect frame = CGRectZero; frame.size = [node layoutThatFits:constrainedSize].size; diff --git a/Source/Details/Transactions/_ASAsyncTransaction.h b/Source/Details/Transactions/_ASAsyncTransaction.h index 25efa51dc..af766ea1f 100644 --- a/Source/Details/Transactions/_ASAsyncTransaction.h +++ b/Source/Details/Transactions/_ASAsyncTransaction.h @@ -62,7 +62,7 @@ ASDK_EXTERN NSInteger const ASDefaultTransactionPriority; @desc This must be called on the main thread. */ -- (void)waitUntilComplete; +- (void)waitUntilComplete NS_SWIFT_UI_ACTOR; /** A block that is called when the transaction is completed. diff --git a/Source/Details/Transactions/_ASAsyncTransactionGroup.h b/Source/Details/Transactions/_ASAsyncTransactionGroup.h index 82b1d7f0d..5d5f307b9 100644 --- a/Source/Details/Transactions/_ASAsyncTransactionGroup.h +++ b/Source/Details/Transactions/_ASAsyncTransactionGroup.h @@ -20,7 +20,7 @@ AS_SUBCLASSING_RESTRICTED /// The main transaction group is scheduled to commit on every tick of the main runloop. /// Access from the main thread only. -@property (class, nonatomic, readonly) _ASAsyncTransactionGroup *mainTransactionGroup; +@property (class, nonatomic, readonly) _ASAsyncTransactionGroup *mainTransactionGroup NS_SWIFT_UI_ACTOR; - (void)commit; diff --git a/Source/Details/_ASDisplayLayer.h b/Source/Details/_ASDisplayLayer.h index c0996b3ea..ea8e1e305 100644 --- a/Source/Details/_ASDisplayLayer.h +++ b/Source/Details/_ASDisplayLayer.h @@ -68,7 +68,7 @@ NS_ASSUME_NONNULL_BEGIN @desc Used by ASDisplayNode to display the layer synchronously on-demand (must be called on the main thread). */ -- (void)displayImmediately; +- (void)displayImmediately NS_SWIFT_UI_ACTOR; @end @@ -122,27 +122,27 @@ NS_ASSUME_NONNULL_BEGIN /** @summary Delegate override for drawParameters */ -- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer; +- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer NS_SWIFT_UI_ACTOR; /** @summary Delegate override for willDisplay */ -- (void)willDisplayAsyncLayer:(_ASDisplayLayer *)layer asynchronously:(BOOL)asynchronously; +- (void)willDisplayAsyncLayer:(_ASDisplayLayer *)layer asynchronously:(BOOL)asynchronously NS_SWIFT_UI_ACTOR; /** @summary Delegate override for didDisplay */ -- (void)didDisplayAsyncLayer:(_ASDisplayLayer *)layer; +- (void)didDisplayAsyncLayer:(_ASDisplayLayer *)layer NS_SWIFT_UI_ACTOR; /** @summary Delegate callback to display a layer, synchronously or asynchronously. 'asyncLayer' does not necessarily need to exist (can be nil). Typically, a delegate will display/draw its own contents and then set .contents on the layer when finished. */ -- (void)displayAsyncLayer:(_ASDisplayLayer *)asyncLayer asynchronously:(BOOL)asynchronously; +- (void)displayAsyncLayer:(_ASDisplayLayer *)asyncLayer asynchronously:(BOOL)asynchronously NS_SWIFT_UI_ACTOR; /** @summary Delegate callback to handle a layer which requests its asynchronous display be cancelled. */ -- (void)cancelDisplayAsyncLayer:(_ASDisplayLayer *)asyncLayer; +- (void)cancelDisplayAsyncLayer:(_ASDisplayLayer *)asyncLayer NS_SWIFT_UI_ACTOR; @end diff --git a/Source/IGListAdapter+AsyncDisplayKit.h b/Source/IGListAdapter+AsyncDisplayKit.h index 83c42fbdd..4b6fc2a44 100644 --- a/Source/IGListAdapter+AsyncDisplayKit.h +++ b/Source/IGListAdapter+AsyncDisplayKit.h @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN * and it must be called on the main thread. -[UIViewController init] * is a good place to call it. This method does not retain the collection node. */ -- (void)setASDKCollectionNode:(ASCollectionNode *)collectionNode; +- (void)setASDKCollectionNode:(ASCollectionNode *)collectionNode NS_SWIFT_UI_ACTOR; @end diff --git a/Source/Layout/ASLayoutSpec.h b/Source/Layout/ASLayoutSpec.h index fbcd71961..1d81da3f3 100644 --- a/Source/Layout/ASLayoutSpec.h +++ b/Source/Layout/ASLayoutSpec.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN /** * A layout spec is an immutable object that describes a layout, loosely inspired by React. */ -@interface ASLayoutSpec : NSObject +NS_SWIFT_SENDABLE @interface ASLayoutSpec : NSObject /** * Creation of a layout spec should only happen by a user in layoutSpecThatFits:. During that method, a diff --git a/Source/Private/ASCollectionView+Undeprecated.h b/Source/Private/ASCollectionView+Undeprecated.h index ce7a514f9..444cbf180 100644 --- a/Source/Private/ASCollectionView+Undeprecated.h +++ b/Source/Private/ASCollectionView+Undeprecated.h @@ -146,7 +146,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 AS_NOESCAPE void (^)(void))updates completion:(nullable NS_SWIFT_UI_ACTOR void ( ^)(BOOL finished))completion NS_SWIFT_UI_ACTOR; /** * Perform a batch of updates asynchronously. This method must be called from the main thread. @@ -157,7 +157,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 AS_NOESCAPE void (^)(void))updates completion:(nullable NS_SWIFT_UI_ACTOR void (^)(BOOL finished))completion NS_SWIFT_UI_ACTOR; /** * Triggers a relayout of all nodes. @@ -169,7 +169,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread. */ -- (void)waitUntilAllUpdatesAreCommitted; +- (void)waitUntilAllUpdatesAreCommitted NS_SWIFT_UI_ACTOR; /** * Registers the given kind of supplementary node for use in creating node-backed supplementary views. @@ -191,7 +191,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; +- (void)insertSections:(NSIndexSet *)sections NS_SWIFT_UI_ACTOR; /** * Deletes one or more sections. @@ -201,7 +201,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; +- (void)deleteSections:(NSIndexSet *)sections NS_SWIFT_UI_ACTOR; /** * Reloads the specified sections. @@ -211,7 +211,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; +- (void)reloadSections:(NSIndexSet *)sections NS_SWIFT_UI_ACTOR; /** * Moves a section to a new location. @@ -223,7 +223,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; +- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection NS_SWIFT_UI_ACTOR; /** * Inserts items at the locations identified by an array of index paths. @@ -233,7 +233,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; +- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths NS_SWIFT_UI_ACTOR; /** * Deletes the items specified by an array of index paths. @@ -243,7 +243,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; +- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths NS_SWIFT_UI_ACTOR; /** * Reloads the specified items. @@ -253,7 +253,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; +- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths NS_SWIFT_UI_ACTOR; /** * Moves the item at a specified location to a destination location. @@ -265,7 +265,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; +- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath NS_SWIFT_UI_ACTOR; /** * Similar to -visibleCells. diff --git a/Source/Private/ASDisplayNode+FrameworkPrivate.h b/Source/Private/ASDisplayNode+FrameworkPrivate.h index fb67dec16..ea6a86280 100644 --- a/Source/Private/ASDisplayNode+FrameworkPrivate.h +++ b/Source/Private/ASDisplayNode+FrameworkPrivate.h @@ -185,7 +185,7 @@ __unused static NSString * _Nonnull NSStringFromASHierarchyStateChange(ASHierarc * In order to guarantee against deadlocks, this method should only be called on the main thread. * It may block on the private queue, [_ASDisplayLayer displayQueue] */ -- (void)recursivelyEnsureDisplaySynchronously:(BOOL)synchronously; +- (void)recursivelyEnsureDisplaySynchronously:(BOOL)synchronously NS_SWIFT_UI_ACTOR; /** * @abstract Calls -didExitPreloadState on the receiver and its subnode hierarchy. diff --git a/Source/Private/ASDisplayNodeTipState.h b/Source/Private/ASDisplayNodeTipState.h index e4dd12c14..6f5321e56 100644 --- a/Source/Private/ASDisplayNodeTipState.h +++ b/Source/Private/ASDisplayNodeTipState.h @@ -25,7 +25,7 @@ AS_SUBCLASSING_RESTRICTED @property (nonatomic, unsafe_unretained, readonly) ASDisplayNode *node; /// Main-thread-only. -@property (nonatomic, nullable) ASTipNode *tipNode; +@property (nonatomic, nullable) NS_SWIFT_UI_ACTOR ASTipNode *tipNode; @end diff --git a/Source/Private/ASImageNode+AnimatedImagePrivate.h b/Source/Private/ASImageNode+AnimatedImagePrivate.h index e5c9d67f5..6ab588ba5 100644 --- a/Source/Private/ASImageNode+AnimatedImagePrivate.h +++ b/Source/Private/ASImageNode+AnimatedImagePrivate.h @@ -20,7 +20,7 @@ NSUInteger _lastSuccessfulFrameIndex; //accessed on main thread only - CFTimeInterval _playHead; + NS_SWIFT_UI_ACTOR CFTimeInterval _playHead; NSUInteger _playedLoops; // Group the BOOLs into a bitfield struct to save memory. diff --git a/Source/Private/ASInternalHelpers.h b/Source/Private/ASInternalHelpers.h index 974467d10..6594b7e34 100644 --- a/Source/Private/ASInternalHelpers.h +++ b/Source/Private/ASInternalHelpers.h @@ -29,7 +29,7 @@ ASDK_EXTERN BOOL ASSubclassOverridesClassSelector(Class superclass, Class subcla ASDK_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 -ASDK_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); +ASDK_EXTERN void ASPerformBlockOnMainThread(void (NS_SWIFT_UI_ACTOR ^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 ASDK_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT diff --git a/Source/Private/ASPendingStateController.h b/Source/Private/ASPendingStateController.h index ad5dab400..14a190ba8 100644 --- a/Source/Private/ASPendingStateController.h +++ b/Source/Private/ASPendingStateController.h @@ -36,7 +36,7 @@ AS_SUBCLASSING_RESTRICTED You must call this method on the main thread. */ -- (void)flush; +- (void)flush NS_SWIFT_UI_ACTOR; /** Register this node as having pending state that needs to be copied diff --git a/Source/Private/ASTableView+Undeprecated.h b/Source/Private/ASTableView+Undeprecated.h index 273a6a71d..ebfb8e79c 100644 --- a/Source/Private/ASTableView+Undeprecated.h +++ b/Source/Private/ASTableView+Undeprecated.h @@ -138,7 +138,7 @@ NS_ASSUME_NONNULL_BEGIN * the main thread. * @warning This method is substantially more expensive than UITableView's version. */ --(void)reloadDataWithCompletion:(void (^ _Nullable)(void))completion; +-(void)reloadDataWithCompletion:(void NS_SWIFT_UI_ACTOR (^ _Nullable)(void))completion; /** * Reload everything from scratch, destroying the working range and all cached nodes. @@ -163,7 +163,7 @@ NS_ASSUME_NONNULL_BEGIN * * @warning This method must be called from the main thread. */ -- (void)beginUpdates; +- (void)beginUpdates NS_SWIFT_UI_ACTOR; /** * Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view, with animation enabled and no completion block. @@ -174,7 +174,7 @@ NS_ASSUME_NONNULL_BEGIN * * @warning This method is must be called from the main thread. */ -- (void)endUpdates; +- (void)endUpdates NS_SWIFT_UI_ACTOR; /** * Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view. @@ -189,12 +189,12 @@ 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; +- (void)endUpdatesAnimated:(BOOL)animated completion:(void NS_SWIFT_UI_ACTOR (^ _Nullable)(BOOL completed))completion NS_SWIFT_UI_ACTOR; /** * Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread. */ -- (void)waitUntilAllUpdatesAreCommitted; +- (void)waitUntilAllUpdatesAreCommitted NS_SWIFT_UI_ACTOR; /** * Inserts one or more sections, with an option to animate the insertion. @@ -206,7 +206,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 withRowAnimation:(UITableViewRowAnimation)animation; +- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animationNS_SWIFT_UI_ACTOR; /** * Deletes one or more sections, with an option to animate the deletion. @@ -218,7 +218,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 withRowAnimation:(UITableViewRowAnimation)animation; +- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation NS_SWIFT_UI_ACTOR; /** * Reloads the specified sections using a given animation effect. @@ -230,7 +230,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 withRowAnimation:(UITableViewRowAnimation)animation; +- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation NS_SWIFT_UI_ACTOR; /** * Moves a section to a new location. @@ -242,7 +242,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; +- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection NS_SWIFT_UI_ACTOR; /** * Inserts rows at the locations identified by an array of index paths, with an option to animate the insertion. @@ -254,7 +254,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)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; +- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation NS_SWIFT_UI_ACTOR; /** * Deletes the rows specified by an array of index paths, with an option to animate the deletion. @@ -266,7 +266,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)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; +- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation NS_SWIFT_UI_ACTOR; /** * Reloads the specified rows using a given animation effect. @@ -278,7 +278,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)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; +- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation NS_SWIFT_UI_ACTOR; /** * Moves the row at a specified location to a destination location. @@ -290,7 +290,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)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; +- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath NS_SWIFT_UI_ACTOR; - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; diff --git a/Source/TextExperiment/Component/ASTextDebugOption.h b/Source/TextExperiment/Component/ASTextDebugOption.h index efa7808c8..1b26cb2ec 100644 --- a/Source/TextExperiment/Component/ASTextDebugOption.h +++ b/Source/TextExperiment/Component/ASTextDebugOption.h @@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN @param option A new debug option (nil is valid). */ -+ (void)setSharedDebugOption:(nullable ASTextDebugOption *)option; ++ (void)setSharedDebugOption:(nullable ASTextDebugOption *)option NS_SWIFT_UI_ACTOR; @end diff --git a/Source/UIResponder+AsyncDisplayKit.h b/Source/UIResponder+AsyncDisplayKit.h index 17afab3ae..573d5e192 100644 --- a/Source/UIResponder+AsyncDisplayKit.h +++ b/Source/UIResponder+AsyncDisplayKit.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN * * This property must be accessed on the main thread. */ -@property (nonatomic, nullable, readonly) __kindof UIViewController *asdk_associatedViewController; +@property (nonatomic, nullable, readonly) NS_SWIFT_UI_ACTOR __kindof UIViewController *asdk_associatedViewController; @end diff --git a/Tests/ASThrashUtility.h b/Tests/ASThrashUtility.h index 09e784775..575f769fd 100644 --- a/Tests/ASThrashUtility.h +++ b/Tests/ASThrashUtility.h @@ -66,7 +66,7 @@ static atomic_uint ASThrashTestItemNextID; @property (nonatomic, readonly) CollectionView *collectionView; @property (nonatomic) NSArray *data; // Only access on main -@property (nonatomic) ASWeakSet *allNodes; +@property (nonatomic) NS_SWIFT_UI_ACTOR ASWeakSet *allNodes; - (instancetype)initTableViewDataSourceWithData:(NSArray *)data; - (instancetype)initCollectionViewDataSourceWithData:(NSArray * _Nullable)data;