Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit a509b75

Browse files
committed
Update interface of ASViewController to use lightweight generics. This allows
subclasses of ASViewController to specify the type of ASDisplayNode it contains which allows for stronger type-checking and auto-completion against the specified type. Example Subclass Declaration: @interface MyASViewController : ASViewController<MyASDisplayNodeSubclass *> @EnD
1 parent 95bd2c2 commit a509b75

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

AsyncDisplayKit/ASViewController.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
NS_ASSUME_NONNULL_BEGIN
1313

14-
@interface ASViewController : UIViewController
14+
@interface ASViewController<__covariant DisplayNodeType : ASDisplayNode *> : UIViewController
1515

16-
- (instancetype)initWithNode:(ASDisplayNode *)node NS_DESIGNATED_INITIALIZER;
16+
- (instancetype)initWithNode:(DisplayNodeType)node NS_DESIGNATED_INITIALIZER;
1717

18-
@property (nonatomic, strong, readonly) ASDisplayNode *node;
18+
@property (nonatomic, strong, readonly) DisplayNodeType node;
1919

2020
/**
2121
* @abstract Passthrough property to the the .interfaceState of the node.

0 commit comments

Comments
 (0)