diff --git a/Source/ASCellNode.h b/Source/ASCellNode.h index 36e5c46093..4957afdffb 100644 --- a/Source/ASCellNode.h +++ b/Source/ASCellNode.h @@ -191,9 +191,9 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { @interface ASCellNode (Unavailable) -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; +- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; +- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; - (void)setLayerBacked:(BOOL)layerBacked AS_UNAVAILABLE("ASCellNode does not support layer-backing"); @@ -208,7 +208,7 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { /** * Initializes a text cell with given text attributes and text insets */ -- (instancetype)initWithAttributes:(NSDictionary *)textAttributes insets:(UIEdgeInsets)textInsets NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithAttributes:(NSDictionary *)textAttributes insets:(UIEdgeInsets)textInsets; /** * Text to display. diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index 3b9a38a95a..deeb1e1ca9 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -125,7 +125,7 @@ extern NSInteger const ASDefaultDrawingPriority; * @return An ASDisplayNode instance whose view will be a subclass that enables asynchronous rendering, and passes * through -layout and touch handling methods. */ -- (instancetype)init NS_DESIGNATED_INITIALIZER; +- (instancetype)init; /** @@ -147,7 +147,7 @@ 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 NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock; /** * @abstract Alternative initializer with a block to create the backing layer. @@ -168,7 +168,7 @@ 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 NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(nullable 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. diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index fd7123b887..f1e134c800 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -316,11 +316,12 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) - (instancetype)initWithViewClass:(Class)viewClass { - if (!(self = [self init])) + if (!(self = [super init])) return nil; ASDisplayNodeAssert([viewClass isSubclassOfClass:[UIView class]], @"should initialize with a subclass of UIView"); + [self _initializeInstance]; _viewClass = viewClass; _flags.synchronous = ![viewClass isSubclassOfClass:[_ASDisplayView class]]; @@ -329,11 +330,12 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) - (instancetype)initWithLayerClass:(Class)layerClass { - if (!(self = [self init])) + if (!(self = [super init])) return nil; ASDisplayNodeAssert([layerClass isSubclassOfClass:[CALayer class]], @"should initialize with a subclass of CALayer"); + [self _initializeInstance]; _layerClass = layerClass; _flags.synchronous = ![layerClass isSubclassOfClass:[_ASDisplayLayer class]]; _flags.layerBacked = YES; diff --git a/Source/ASEditableTextNode.h b/Source/ASEditableTextNode.h index d395876ac1..71d4a89da1 100644 --- a/Source/ASEditableTextNode.h +++ b/Source/ASEditableTextNode.h @@ -136,9 +136,9 @@ NS_ASSUME_NONNULL_BEGIN @interface ASEditableTextNode (Unavailable) -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; +- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; +- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; @end diff --git a/Source/ASMultiplexImageNode.h b/Source/ASMultiplexImageNode.h index 6ea08c2c38..5320a461f4 100644 --- a/Source/ASMultiplexImageNode.h +++ b/Source/ASMultiplexImageNode.h @@ -134,16 +134,6 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { #endif @end -#pragma mark - - -@interface ASMultiplexImageNode (Unavailable) - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -@end - #pragma mark - /** diff --git a/Source/ASMultiplexImageNode.mm b/Source/ASMultiplexImageNode.mm index c26354f43a..0b3523c709 100644 --- a/Source/ASMultiplexImageNode.mm +++ b/Source/ASMultiplexImageNode.mm @@ -149,8 +149,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent @implementation ASMultiplexImageNode -#pragma mark - Lifecycle - +#pragma mark - Getting Started / Tearing Down - (instancetype)initWithCache:(id)cache downloader:(id)downloader { if (!(self = [super init])) @@ -180,18 +179,6 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent #endif } -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock -{ - ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER(); - return [self init]; -} - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock -{ - ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER(); - return [self init]; -} - - (void)dealloc { [_phImageRequestOperation cancel]; diff --git a/Source/ASNetworkImageNode.h b/Source/ASNetworkImageNode.h index 4f3803aa77..0f984eea37 100644 --- a/Source/ASNetworkImageNode.h +++ b/Source/ASNetworkImageNode.h @@ -112,15 +112,6 @@ NS_ASSUME_NONNULL_BEGIN @end -#pragma mark - - -@interface ASNetworkImageNode (Unavailable) - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -@end #pragma mark - /** diff --git a/Source/ASNetworkImageNode.mm b/Source/ASNetworkImageNode.mm index 85b88bca76..40e4bbf5b8 100755 --- a/Source/ASNetworkImageNode.mm +++ b/Source/ASNetworkImageNode.mm @@ -102,18 +102,6 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0}; #endif } -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock -{ - ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER(); - return [self init]; -} - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock -{ - ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER(); - return [self init]; -} - - (void)dealloc { [self _cancelImageDownload]; diff --git a/Source/ASScrollNode.mm b/Source/ASScrollNode.mm index 9e110d0155..6e9afc69c7 100644 --- a/Source/ASScrollNode.mm +++ b/Source/ASScrollNode.mm @@ -64,7 +64,7 @@ - (instancetype)init { - return [super initWithViewBlock:^UIView *{ return [[ASScrollView alloc] init]; } didLoadBlock:nil]; + return [super initWithViewBlock:^UIView *{ return [[ASScrollView alloc] init]; }]; } - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize diff --git a/Source/ASTextNode.h b/Source/ASTextNode.h index a5544d5a2f..78bdd12005 100644 --- a/Source/ASTextNode.h +++ b/Source/ASTextNode.h @@ -282,9 +282,9 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { @interface ASTextNode (Unavailable) -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; +- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; +- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; @end diff --git a/Source/ASVideoNode.h b/Source/ASVideoNode.h index d4f6bb7a3d..63b8334338 100644 --- a/Source/ASVideoNode.h +++ b/Source/ASVideoNode.h @@ -145,11 +145,8 @@ NS_ASSUME_NONNULL_BEGIN @interface ASVideoNode (Unavailable) -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; +- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock __unavailable; @end - NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASAbstractLayoutController.h b/Source/Details/ASAbstractLayoutController.h index 0394fa70ef..c79f13e8b3 100644 --- a/Source/Details/ASAbstractLayoutController.h +++ b/Source/Details/ASAbstractLayoutController.h @@ -29,9 +29,9 @@ ASDISPLAYNODE_EXTERN_C_END @interface ASAbstractLayoutController (Unavailable) -- (NSSet *)indexPathsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType NS_UNAVAILABLE; +- (NSSet *)indexPathsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType __unavailable; -- (void)allIndexPathsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode displaySet:(NSSet * _Nullable * _Nullable)displaySet preloadSet:(NSSet * _Nullable * _Nullable)preloadSet NS_UNAVAILABLE; +- (void)allIndexPathsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode displaySet:(NSSet * _Nullable * _Nullable)displaySet preloadSet:(NSSet * _Nullable * _Nullable)preloadSet __unavailable; @end diff --git a/Source/Layout/ASLayout.h b/Source/Layout/ASLayout.h index ca01744d2a..b592ddb13b 100644 --- a/Source/Layout/ASLayout.h +++ b/Source/Layout/ASLayout.h @@ -144,7 +144,7 @@ ASDISPLAYNODE_EXTERN_C_END @interface ASLayout (Unavailable) -- (instancetype)init NS_UNAVAILABLE; +- (instancetype)init __unavailable; @end diff --git a/Source/Layout/ASLayoutSpec+Subclasses.mm b/Source/Layout/ASLayoutSpec+Subclasses.mm index 083d1e14c9..a743364ee5 100644 --- a/Source/Layout/ASLayoutSpec+Subclasses.mm +++ b/Source/Layout/ASLayoutSpec+Subclasses.mm @@ -14,7 +14,7 @@ #pragma mark - ASNullLayoutSpec @interface ASNullLayoutSpec : ASLayoutSpec -- (instancetype)init NS_UNAVAILABLE; +- (instancetype)init __unavailable; + (ASNullLayoutSpec *)null; @end diff --git a/Source/Layout/ASLayoutSpec.h b/Source/Layout/ASLayoutSpec.h index fe8bb67a9a..4a28709d56 100644 --- a/Source/Layout/ASLayoutSpec.h +++ b/Source/Layout/ASLayoutSpec.h @@ -84,7 +84,7 @@ NS_ASSUME_NONNULL_BEGIN /* * Init not available for ASWrapperLayoutSpec */ -- (instancetype)init NS_UNAVAILABLE; +- (instancetype)init __unavailable; @end diff --git a/Source/Private/ASCollectionViewFlowLayoutInspector.h b/Source/Private/ASCollectionViewFlowLayoutInspector.h index edbdedcb68..8505d3d7bd 100644 --- a/Source/Private/ASCollectionViewFlowLayoutInspector.h +++ b/Source/Private/ASCollectionViewFlowLayoutInspector.h @@ -24,7 +24,6 @@ AS_SUBCLASSING_RESTRICTED @property (nonatomic, weak, readonly) UICollectionViewFlowLayout *layout; - (instancetype)init NS_UNAVAILABLE; - - (instancetype)initWithFlowLayout:(UICollectionViewFlowLayout *)flowLayout NS_DESIGNATED_INITIALIZER; @end diff --git a/Source/Private/ASLayoutTransition.h b/Source/Private/ASLayoutTransition.h index 52a05834d0..f3e384e901 100644 --- a/Source/Private/ASLayoutTransition.h +++ b/Source/Private/ASLayoutTransition.h @@ -93,7 +93,7 @@ AS_SUBCLASSING_RESTRICTED @interface ASLayoutTransition (Unavailable) -- (instancetype)init NS_UNAVAILABLE; +- (instancetype)init __unavailable; @end diff --git a/Source/Private/ASMutableElementMap.h b/Source/Private/ASMutableElementMap.h index b6f9f22ea4..221353e573 100644 --- a/Source/Private/ASMutableElementMap.h +++ b/Source/Private/ASMutableElementMap.h @@ -21,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN AS_SUBCLASSING_RESTRICTED @interface ASMutableElementMap : NSObject +- (instancetype)init __unavailable; + - (instancetype)initWithSections:(NSArray *)sections items:(ASCollectionElementTwoDimensionalArray *)items supplementaryElements:(ASSupplementaryElementDictionary *)supplementaryElements; - (void)insertSection:(ASSection *)section atIndex:(NSInteger)index; @@ -47,10 +49,4 @@ AS_SUBCLASSING_RESTRICTED @interface ASElementMap (MutableCopying) @end -@interface ASMutableElementMap (Unavailable) - -- (instancetype)init NS_UNAVAILABLE; - -@end - NS_ASSUME_NONNULL_END diff --git a/Source/Private/ASSection.h b/Source/Private/ASSection.h index 42f71e2ce4..4944415d5b 100644 --- a/Source/Private/ASSection.h +++ b/Source/Private/ASSection.h @@ -19,7 +19,7 @@ @property (nonatomic, assign, readonly) NSInteger sectionID; @property (nonatomic, strong, nullable, readonly) id context; -- (nullable instancetype)init NS_UNAVAILABLE; +- (nullable instancetype)init __unavailable; - (nullable instancetype)initWithSectionID:(NSInteger)sectionID context:(nullable id)context NS_DESIGNATED_INITIALIZER; @end