SwiftUI view with rounded corners AND border

SwiftUI borders have straight edges no matter what corner radius you apply (.cornerRadius simply clips the view to a rounded mask and doesn’t adjust the border’s appearance). If you want a rounded border, you’ll need to overlay and .stroke a rounded rectangle: VStack { Text(“some text”) Button(“Ok”) {} .foregroundColor(.cyan) .padding() } .padding() .background(.red) .cornerRadius(20) /// … Read more

tech