Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rounded Borders in SwiftUI

Tags:

People also ask

How do I make a rounded border in SwiftUI?

Any SwiftUI view can have its corners rounded using the cornerRadius() modifier. This takes a simple value in points that controls how pronounced the rounding should be.

How do I add a border to a shape in SwiftUI?

To change that, and make the shape view act as a border, all we have to do is to apply a stroke to it, passing as argument the desired color. Text("Borders in SwiftUI!") Text("Borders in SwiftUI!") Text("Borders in SwiftUI!")

How do you make a rounded corner view?

You can give it round corners by changing the cornerRadius property of the view's layer . and smaller values give less rounded corners. Both clipsToBounds and masksToBounds are equivalent.


How do I round borders in SwiftUI?

I would assume this would work:

.cornerRadius(10)
.border(Color.white)

Tho it dose not work.

This is my workaround for now:

.overlay(RoundedRectangle(cornerRadius: 10).stroke(lineWidth: 1).foregroundColor(.white))