[ASTraitCollection] Remove traitCollectionContext from ASTraitCollection; add containerWindowSize

Passing around a pointer was leading to crashes as the ASVC was the sole owner of the context. There are cases where the VC would dealloc while its subnodes were laying out. This could lead to the subnodes accessing a garbage pointer.
This commit is contained in:
ricky
2016-07-07 09:23:37 -07:00
parent c62a4d3e79
commit 637c4f3a9f
7 changed files with 28 additions and 112 deletions

View File

@@ -27,18 +27,6 @@ typedef ASTraitCollection * _Nonnull (^ASDisplayTraitsForTraitWindowSizeBlock)(C
@property (nonatomic, strong, readonly) DisplayNodeType node;
/**
* An optional context to pass along with an ASTraitCollection.
* This can be used to pass any internal state to all subnodes via the ASTraitCollection that is not
* included in UITraitCollection. This could range from more fine-tuned size classes to a class of
* constants that is based upon the new trait collection.
*
* Be aware that internally this context is held by a C struct which cannot retain the pointer. Therefore
* ASVC keeps a strong reference to the context to make sure that it stays alive. If you change this value
* it will propagate the change to the subnodes.
*/
@property (nonatomic, strong) id _Nullable traitCollectionContext;
/**
* Set this block to customize the ASDisplayTraits returned when the VC transitions to the given traitCollection.
*/