Updated for Xcode 13.0 beta 2
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.
So, you can create a text view with 25-point rounded corners like this:
Text("Round Me") .padding() .background(Color.red) .cornerRadius(25)
You can automatically round the shortest edge fully by using the
clipShape() modifier with a
Capsule, like this:
Text("Round Me") .padding() .background(Color.red) .clipShape(Capsule())
SPONSORED From August 2nd to 8th you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer!
Link copied to your pasteboard.