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..79f20019a 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 diff --git a/Source/ASCollectionNode.h b/Source/ASCollectionNode.h index 2c9c729f0..bad706f6a 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:. @@ -316,7 +316,7 @@ NS_ASSUME_NONNULL_BEGIN /** * 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. @@ -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. @@ -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. @@ -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. @@ -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; /** @@ -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 @@ -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. 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+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..5bb883eee 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. @@ -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 void(^)(void))completion NS_SWIFT_UI_ACTOR; /** 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/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