Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.51k stars 1.1k forks source link

TextView Line Corner Radius Issue #474

Closed efalloon closed 2 years ago

efalloon commented 2 years ago

I cannot set a line corner radius on a textview using the .linesCornerRadius function programatically. However, when I apply the said corner radius on storyboards, it works.

JacksonJang commented 2 years ago

I solved issue

link : https://github.com/Juanpe/SkeletonView/pull/475

have a good day^^

Juanpe commented 2 years ago

Hi @efalloon 👋🏼

I've checked this issue and I can't reproduce this issue. I mean, in the example project, if I set programmatically the corner radius, it works.

efalloon commented 2 years ago

descriptionTextView.isSkeletonable = true descriptionTextView.showSkeleton(usingColor: .tertiarySystemFill, transition: .crossDissolve(1)) descriptionTextView.skeletonCornerRadius = 5 descriptionTextView.lastLineFillPercent = Int.random(in: 30..<75) descriptionTextView.skeletonLineSpacing = 12.5 descriptionTextView.isScrollEnabled = false This is what my code currently looks like. Everything works except for the corner radius.

Juanpe commented 2 years ago

Ok, the problem is that you are not using the right property. You have to use linesCornerRadius. And you have to set all the properties before show the skeleton as well.

Your code would look like this:

descriptionTextView.isSkeletonable = true 
descriptionTextView.linesCornerRadius = 5 
descriptionTextView.lastLineFillPercent = Int.random(in: 30..<75) 
descriptionTextView.skeletonLineSpacing = 12.5 
descriptionTextView.isScrollEnabled = false

descriptionTextView.showSkeleton(usingColor: .tertiarySystemFill, transition: .crossDissolve(1))

BTW, I think I should clarify this in the README file because it looks confusing

@efalloon, could you check it to close this issue, please? Thanks 👍🏼