diff --git a/CHANGELOG.md b/CHANGELOG.md index 714b1f9d12..e9752ddbda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## master * Add your own contributions to the next release on the line below this with your name. +- [Breaking][ASDisplayNode] Make interface state delegate protocol required. [Max Wang](https://github.com/wsdwsd0829). [#1112](https://github.com/TextureGroup/Texture/pull/1112) - [ASCollectionView] Fix reording of cells manually for iOS 9 & 10. [Max Wang](https://github.com/wsdwsd0829). [#1081](https://github.com/TextureGroup/Texture/pull/1081) - [ASDisplayNode] Allow add/remove interface state delegates on background thread. [Max Wang](https://github.com/wsdwsd0829). [#1090](https://github.com/TextureGroup/Texture/pull/1090) - [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses).[Scott Goodson](https://github.com/appleguy) [#1077](https://github.com/TextureGroup/Texture/pull/1077) diff --git a/Source/ASDisplayNode+InterfaceState.h b/Source/ASDisplayNode+InterfaceState.h index cca1e4e729..ec4414bb77 100644 --- a/Source/ASDisplayNode+InterfaceState.h +++ b/Source/ASDisplayNode+InterfaceState.h @@ -40,7 +40,6 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState) }; @protocol ASInterfaceStateDelegate -@optional /** * @abstract Called whenever any bit in the ASInterfaceState bitfield is changed. diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index 2cf3438a6e..c3d914671e 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -460,9 +460,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__); } \ __instanceLock__.unlock(); \ for (id delegate in delegates) { \ - if ([delegate respondsToSelector:@selector(method)]) { \ - [delegate method]; \ - } \ + [delegate method]; \ } - (BOOL)_locked_shouldLoadViewOrLayer @@ -3220,9 +3218,7 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { NSHashTable *delegates = [_interfaceStateDelegates copy]; __instanceLock__.unlock(); for (id delegate in delegates) { - if ([delegate respondsToSelector:@selector(interfaceStateDidChange:fromState:)]) { - [delegate interfaceStateDidChange:newState fromState:oldState]; - } + [delegate interfaceStateDidChange:newState fromState:oldState]; } } diff --git a/Source/ASNodeController+Beta.h b/Source/ASNodeController+Beta.h index 7c00ba8fed..e5bcc29622 100644 --- a/Source/ASNodeController+Beta.h +++ b/Source/ASNodeController+Beta.h @@ -38,6 +38,8 @@ - (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState ASDISPLAYNODE_REQUIRES_SUPER; +- (void)hierarchyDisplayDidFinish ASDISPLAYNODE_REQUIRES_SUPER; + @end @interface ASDisplayNode (ASNodeController) diff --git a/Source/ASNodeController+Beta.mm b/Source/ASNodeController+Beta.mm index 77199b25f6..201b3cfb93 100644 --- a/Source/ASNodeController+Beta.mm +++ b/Source/ASNodeController+Beta.mm @@ -80,6 +80,8 @@ - (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState {} +- (void)hierarchyDisplayDidFinish {} + @end @implementation ASDisplayNode (ASNodeController)