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

[ASCollectionView] Add a "Null Object" for a layout inspector if custom layout is given but no layout inspector#1674

Merged
appleguy merged 1 commit intofacebookarchive:masterfrom
maicki:RefactorASCollectionViewLayoutInspectingUsage
Jun 5, 2016
Merged

[ASCollectionView] Add a "Null Object" for a layout inspector if custom layout is given but no layout inspector#1674
appleguy merged 1 commit intofacebookarchive:masterfrom
maicki:RefactorASCollectionViewLayoutInspectingUsage

Conversation

@maicki
Copy link
Copy Markdown
Contributor

@maicki maicki commented May 17, 2016

The purpose of the ASCollectionViewCustomLayoutInspector is to provide a default implementation if a custom layout is given, but no layout inspector. We remove the necessary if handling if no layout inspector is given and replace it with a "Null Object".

@ghost ghost added the CLA Signed label May 17, 2016
The purpose of the ASCollectionViewCustomLayoutInspector is to provide a default implementation if given a custom layout, but no layout inspector.
// and asserts for methods that should be implemented in the <ASCollectionViewLayoutInspecting>
_defaultLayoutInspector = [[ASCollectionViewCustomLayoutInspector alloc] init];
}
_layoutInspector = _defaultLayoutInspector;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the _defaultLayoutInspector ivar necessary or can we make it a local var?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because _layoutInspector is a weak property

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maicki aha, that makes total sense. Maybe let's call it _strongLayoutInspector so the purpose is more clear.

@appleguy appleguy added this to the 1.9.8 milestone Jun 4, 2016
@appleguy appleguy merged commit c9b448b into facebookarchive:master Jun 5, 2016
@maicki maicki deleted the RefactorASCollectionViewLayoutInspectingUsage branch June 16, 2016 17:25
aimalygin pushed a commit to aimalygin/AsyncDisplayKit that referenced this pull request Sep 23, 2019
… Style Changes (facebookarchive#1674)

* This PR addresses an issue I raised with facebookarchive#1673 where the clipping corner layer doesn't get re-rendered when going from a dark to light user interface style. The fix is to add code in the `-asyncTraitCollectionDidChangeWithPreviousTraitCollection:` method that calls through to `-_updateClipCornerLayerContentsWithRadius:backgroundColor:` if the user interface style changes.

I've also added snapshot tests to verify that using clipping corners with a dynamic background color updates when the user interface style changes.
aimalygin pushed a commit to aimalygin/AsyncDisplayKit that referenced this pull request Sep 23, 2019
…nDidChange (facebookarchive#1678)

traitCollectionDidChange isn't necessarily called on Main, but our self.backgroundColor property access must be done on main once the view is loaded.

I originally opted to use self.backgroundColor rather than _backgroundColor in facebookarchive#1674, but I think we should use the ivar here. This could get out-of-sync if someone modified the UIView's background color instead of updating the node, but I think that's unlikely, so we should be safe to use the ivar here.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants