Skip to content

Vend preferredContentSize through the DescribedViewController #1051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

zradke
Copy link
Contributor

@zradke zradke commented Mar 30, 2020

Because the DescribedViewController wraps all view controllers used in
workflows, if it does not vend its current child's
preferredContentSize, it will be lost. This makes it very difficult to
create dynamic workflows that rely on self-sizing view controllers
without introducing workarounds to have the children communicate their
intended size to the parent, or by removing the convenience of the
DescribedViewController entirely. This change solves the issue by
having the DescribedViewController update its own
preferredContentSize to match whatever the currentViewController is,
and when that child's size changes.

@CLAassistant
Copy link

CLAassistant commented Mar 30, 2020

CLA assistant check
All committers have signed the CLA.

@zach-klippenstein zach-klippenstein added bug Something isn't working swift Affects the Swift library. labels Mar 30, 2020
Copy link
Collaborator

@bencochran bencochran left a comment

Choose a reason for hiding this comment

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

This is great, thanks! Especially thanks for all the DescribedViewController tests!

Copy link
Contributor

@dhavalshreyas dhavalshreyas left a comment

Choose a reason for hiding this comment

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

Thank you!

@@ -0,0 +1,318 @@
//
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: we don't use comment headers like this.

Because the `DescribedViewController` wraps all view controllers used in
workflows, if it does not vend its current child's
`preferredContentSize`, it will be lost. This makes it very difficult to
create dynamic workflows that rely on self-sizing view controllers
without introducing workarounds to have the children communicate their
intended size to the parent, or by removing the convenience of the
`DescribedViewController` entirely. This change solves the issue by
having the `DescribedViewController` update its own
`preferredContentSize` to match whatever the `currentViewController` is,
and when that child's size changes.
@zradke zradke force-pushed the zradke/preferred-content-size branch from f2def8f to 889a198 Compare March 31, 2020 13:51
@JustinDSN JustinDSN merged commit ddbe355 into square:master Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swift Affects the Swift library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants