From 31ffea40c23fad51a380b1d55d0f6ba09623b39b Mon Sep 17 00:00:00 2001 From: Marvin Nazari Date: Thu, 17 Nov 2016 11:26:55 +0100 Subject: [PATCH] [ASCellNode] implement a .viewController property --- AsyncDisplayKit/ASCellNode.h | 7 +++++++ AsyncDisplayKit/ASCellNode.mm | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/AsyncDisplayKit/ASCellNode.h b/AsyncDisplayKit/ASCellNode.h index 0a6ccf3fb3..d5ae55aec4 100644 --- a/AsyncDisplayKit/ASCellNode.h +++ b/AsyncDisplayKit/ASCellNode.h @@ -116,6 +116,13 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { */ @property (nonatomic, readonly, nullable) NSIndexPath *indexPath; +/** + * 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 (nonatomic, readonly, nullable) UIViewController *viewController; + + /** * The owning node (ASCollectionNode/ASTableNode) of this cell node, or @c nil if this node is * not a valid item inside a table node or collection node or if those nodes are nil. diff --git a/AsyncDisplayKit/ASCellNode.mm b/AsyncDisplayKit/ASCellNode.mm index 84c81b6bf6..dd320fabdd 100644 --- a/AsyncDisplayKit/ASCellNode.mm +++ b/AsyncDisplayKit/ASCellNode.mm @@ -236,6 +236,12 @@ static NSMutableSet *__cellClassesForVisibilityNotifications = nil; // See +init return nil; } +- (UIViewController *)viewController +{ + ASDisplayNodeAssertMainThread(); + return _viewController; +} + #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wobjc-missing-super-calls"