Skip to content
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

Updated Divider as UIView #1262

Closed
wants to merge 1 commit into from
Closed

Updated Divider as UIView #1262

wants to merge 1 commit into from

Conversation

o-nnerb
Copy link

@o-nnerb o-nnerb commented Sep 6, 2019

Updated Divider to be a UIView class using layout constraints. This approach turns divider more flexible to constraints updates from superview.

@daniel-jonathan
Copy link
Member

On initial glance, this looks great. @adamdahan will comment further, and thank you @brennobemoura for sharing this with us.

@adamdahan
Copy link
Contributor

@brennobemoura Do you have any sample code for how you animate the divider which cause the original problem mentioned in ticket: #1252?

@o-nnerb
Copy link
Author

o-nnerb commented Sep 8, 2019

I will search here. The problem happened around March or April and since them I write this version for Divider and it works. I remember to use the Skeleton view and when it's stops animating the divider was in wrong place or in a different size from view.

@o-nnerb
Copy link
Author

o-nnerb commented Sep 8, 2019

Today I will search in my code or try to reproduce the error, just wait a little

@o-nnerb
Copy link
Author

o-nnerb commented Sep 8, 2019

Divider overrode:
Divider overrode

Divider from Material:
Divider from Material

This view is not using skeleton view

@daniel-jonathan daniel-jonathan assigned adamdahan and unassigned o-nnerb Sep 8, 2019
Copy link
Contributor

@OrkhanAlikhanov OrkhanAlikhanov 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 for your PR!
Overall the PR looks solid! However, there are some API changes that would potentially break existing apps. Also, as you said in #1252 (comment) calling layoutDivider() works. We can actually eliminate calling layoutDivider manually if we use autolayout as you suggested, but this PR does more than that. @adamdahan, @DanielDahan What do you think?

case .bottom, .top:
superview.layout(self)
.leading(c.left, { _, _ in .equal })
.trailing(c.right, {_, _ in .equal })
Copy link
Contributor

Choose a reason for hiding this comment

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

See #1236 to learn about layout relations. You can reduce this to .leading(c.left)


init(square: CGFloat) {
self.init(top: square, left: square, bottom: square, right: square)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I like these additions but would be better if you had done these changes in separate commits so that we could see changes separately with a nice commit message instead of sorting the changes in our mind.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nice little clean up.


extension UIView {
/// TabBarItem reference.
public private(set) var divider: Divider {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems now instead of view.divider we need to do Divider.from(view: view). This is a radical API change

Copy link
Member

Choose a reason for hiding this comment

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

I personally do not like the Divider.from(view: view) API change at all. Maybe we need to reconsider the entire divider on a UIView completely. @OrkhanAlikhanov @adamdahan

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup I agree with both of you @OrkhanAlikhanov @DanielDahan I like some of the refactoring done but overall the impact of this change is to large for existing users of Material.

@adamdahan
Copy link
Contributor

@DanielDahan @OrkhanAlikhanov overall I think we should close this PR for now as it is a "one off situation" for @brennobemoura issue with his app. Let's utilize the idea's @brennobemoura presented for clean up and constraint based layout and figure out our overall position with Divider for our next big updates.

@daniel-jonathan
Copy link
Member

@adamdahan I agree. This PR has presented some really nice ideas to consider, and I like that a lot, so thank you @brennobemoura.

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

Successfully merging this pull request may close these issues.

None yet

4 participants