Skip to content

Commit

Permalink
better roundedCorner
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed May 1, 2023
1 parent 52d7084 commit 31e4661
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ extension ViewComponent {

extension ViewComponent where R.View: UIView {
public func roundedCorner() -> ViewUpdateComponent<Self> {
update { view in
view.cornerRadius = min(view.bounds.width, view.bounds.height) / 2
ViewModifierComponent(content: self) { node in
node.update { view in
view.cornerRadius = min(node.size.width, node.size.height) / 2
}
}
}
}

0 comments on commit 31e4661

Please sign in to comment.