Skip to content

Add method sizeToFit() - #158

Merged
lucdion merged 7 commits into
masterfrom
sizeToFit
Jul 17, 2018
Merged

lucdion merged 7 commits into
masterfrom
sizeToFit

Conversation

@lucdion

@lucdion lucdion commented Jul 16, 2018

Copy link
Copy Markdown
Member

Add a method sizeToFit().
The method adjust the view's size based on the result of the method UIView.sizeToFit()

Example:

view.pin.center().sizeToFit()

@antoinelamy

antoinelamy commented Jul 17, 2018 •

Copy link
Copy Markdown
Contributor

It would be nice to remove sizeToFit() in the SizeCalculable protocol, I made a mistake in putting it there. According to the documentation, sizeToFit() only calls sizeThatFits with the current view bounds and assign that size (probably with some validations).

@antoinelamy

antoinelamy commented Jul 17, 2018 •

Copy link
Copy Markdown
Contributor

Or we can also leave it as is but I feel that there is a bit of repetition there since no view should override sizeToFit() directly but do so for sizeThatFits() instead.

@lucdion

lucdion commented Jul 17, 2018

Copy link
Copy Markdown
Member Author

@antoinelamy I will keep it that way in this PR, but we have a discussion about this.

@lucdion
lucdion merged commit 84b4f7a into master Jul 17, 2018
@lucdion
lucdion deleted the sizeToFit branch July 17, 2018 14:11
@cajurabi

Copy link
Copy Markdown

@lucdion @antoinelamy my 2cents would be to remove from the SizeCalculable protocol for UIKit consistency. Thanks for the great work on PinLayout and FlexLayout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants