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

Fix to consider the top and bottom edge insets when updating the skeleton layer height #319

Merged
merged 2 commits into from Sep 7, 2020

Conversation

xpereta
Copy link
Contributor

@xpereta xpereta commented Aug 31, 2020

The .top property of skeletonPaddingInsets is being used to offset the position of the skeleton layer, but the .bottom property is left unused. As a result the skeleton layer has a larger height than expected.

To reproduce de issue using the example application we can change the header label to use a bigger font:

Screenshot 2020-08-31 at 16 58 45

And then add this line to configure the skeletonPaddingInsets:

    lazy var titleLabel: UILabel = {
        let label = UILabel()
        
        label.text = "      "
        label.font = UIFont.systemFont(ofSize: 40)
        label.isSkeletonable = true
        label.skeletonPaddingInsets = UIEdgeInsets(top: 30, left: 0, bottom: 30, right: 0)
        label.linesCornerRadius = 5
        
        return label
    }()

The skeleton layer is larger than expected:

Screenshot 2020-08-31 at 16 59 11

With the change in this PR, the .bottom property is used and the skeleton layer has the expected height:

Screenshot 2020-08-31 at 16 58 42

Please tell me if I'd rather create an issue to discuss it and then add a line in the changelog if you eventually approve it.

Thanks!

@Juanpe
Copy link
Owner

Juanpe commented Sep 1, 2020

Hi @xpereta, thanks for contributing :)

Simple but useful PR, go ahead with the CHANGELOG 👍

welcome aboard!

@xpereta xpereta changed the title fix: Consider the bottom edge inset when updating the skeleton layer. fix: Consider the top and bottom edge insets when updating the skeleton layer height. Sep 3, 2020
@xpereta xpereta changed the title fix: Consider the top and bottom edge insets when updating the skeleton layer height. Fix to consider the top and bottom edge insets when updating the skeleton layer height Sep 3, 2020
@xpereta
Copy link
Contributor Author

xpereta commented Sep 3, 2020

I updated the PR to also consider the top edge inset to calculate the skeleton layer height.

@Juanpe
Copy link
Owner

Juanpe commented Sep 7, 2020

Thanks for your first contribution to SkeletonView 👏

@Juanpe Juanpe merged commit 997c62b into Juanpe:develop Sep 7, 2020
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.

None yet

2 participants