64
64
65
65
static ASDisplayNodeNonFatalErrorBlock _nonFatalErrorBlock = nil;
66
66
67
- @interface ASDisplayNode () <UIGestureRecognizerDelegate, _ASDisplayLayerDelegate, ASCATransactionQueueObserving>
67
+ // Forward declare CALayerDelegate protocol as the iOS 10 SDK moves CALayerDelegate from an informal delegate to a protocol.
68
+ // We have to forward declare the protocol as this place otherwise it will not compile compiling with an Base SDK < iOS 10
69
+ @protocol CALayerDelegate;
70
+
71
+ @interface ASDisplayNode () <UIGestureRecognizerDelegate, CALayerDelegate, _ASDisplayLayerDelegate, ASCATransactionQueueObserving>
68
72
/**
69
73
* See ASDisplayNodeInternal.h for ivars
70
74
*/
@@ -103,13 +107,9 @@ BOOL ASDisplayNodeNeedsSpecialPropertiesHandling(BOOL isSynchronous, BOOL isLaye
103
107
return result;
104
108
}
105
109
106
- void StubImplementationWithNoArgs(id receiver, SEL _cmd) {}
107
- void StubImplementationWithSizeRange(id receiver, SEL _cmd, ASSizeRange sr) {}
108
- void StubImplementationWithTwoInterfaceStates(id receiver, SEL _cmd, ASInterfaceState s0, ASInterfaceState s1) {}
109
-
110
- /// Returning nil here won't trigger unwanted default actions, because we override
111
- /// +defaultActionForKey: to return kCFNull.
112
- id StubLayerActionImplementation(id receiver, SEL _cmd, NSString *key) { return nil; }
110
+ void StubImplementationWithNoArgs(id receiver) {}
111
+ void StubImplementationWithSizeRange(id receiver, ASSizeRange sr) {}
112
+ void StubImplementationWithTwoInterfaceStates(id receiver, ASInterfaceState s0, ASInterfaceState s1) {}
113
113
114
114
/**
115
115
* Returns ASDisplayNodeFlags for the given class/instance. instance MAY BE NIL.
@@ -264,8 +264,6 @@ + (void)initialize
264
264
auto interfaceStateType = std::string(@encode(ASInterfaceState));
265
265
auto type1 = "v@:" + interfaceStateType + interfaceStateType;
266
266
class_addMethod(self, @selector(interfaceStateDidChange:fromState:), (IMP)StubImplementationWithTwoInterfaceStates, type1.c_str());
267
-
268
- class_addMethod(self, @selector(layerActionForKey:), (IMP)StubLayerActionImplementation, "@@:@");
269
267
}
270
268
}
271
269
@@ -1720,6 +1718,7 @@ - (void)subnodeDisplayDidFinish:(ASDisplayNode *)subnode
1720
1718
1721
1719
#pragma mark <CALayerDelegate>
1722
1720
1721
+ // We are only the delegate for the layer when we are layer-backed, as UIView performs this function normally
1723
1722
- (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event
1724
1723
{
1725
1724
if (event == kCAOnOrderIn) {
@@ -1728,7 +1727,8 @@ - (void)subnodeDisplayDidFinish:(ASDisplayNode *)subnode
1728
1727
[self __exitHierarchy];
1729
1728
}
1730
1729
1731
- return [self layerActionForKey:event];
1730
+ ASDisplayNodeAssert(_flags.layerBacked, @"We shouldn't get called back here unless we are layer-backed.");
1731
+ return (id)kCFNull;
1732
1732
}
1733
1733
1734
1734
#pragma mark - Error Handling
0 commit comments