Rightpoint / Anchorage

A collection of operators and utilities that simplify iOS layout code.
MIT License
627 stars 46 forks source link

Remove convenience accessors on UIViewController subclasses #82

Closed armcknight closed 4 years ago

armcknight commented 4 years ago

I recently hit a bug where I had a child VC inside a parent VC, and had set the child VC's edge anchors to the parent view's edges. (Not the child VC view, but the child VC itself.) This led to a bug where on X series phones, in a UINavigationController presented modally, when the parent (containing the child) VC was pushed onto the nav controller, the VC's bottom edge appeared to sink lower towards the bottom edge of the screen, and some content wound up underneath the Home Indicator.

Changing the line of code from

childVC.edgeAnchors == parentVC.view.edgeAnchors

to

childVC.view.edgeAnchors == parentVC.view.edgeAnchors

fixed the issue.

I propose removing the convenience accessors for things like edgeAnchors from UIViewController, as it appears to produce different behaviors on different devices, introduces ambiguity to the layout semantics, and can be difficult to spot.

ZevEisenberg commented 4 years ago

I’m at least in favor of deprecating them. They were there as a convenience wrapper around the topLayoutGuide and bottomLayoutGuide, but since those were replaced with the safeAreaLayoutGuide, I think we can probably remove them. I’d happily merge a PR deprecating these.

needhamwoodj commented 4 years ago

Closing Issue, Issue was addressed in PR https://github.com/Rightpoint/Anchorage/pull/85 which has been approved and merged.