Post

Replies

Boosts

Views

Activity

SwiftUI using the width of a view in its modifiers
I'm trying to create a rounded button with dynamic height/width. To be perfectly rounded, the corner radius must be equal to half of the button's height. Is there a way to dynamically update the corner radius used by the modifier as the view's bound's are changed? This is what I have so far for the button's label: HStack { 		Image(systemName: "plus") 		Text("Add") } .padding(.vertical, 5) .padding(.horizontal) .overlay(RoundedRectangle(cornerRadius: 10).stroke(lineWidth: 1))
4
0
2.7k
Jun ’20