Updated for Xcode 16.4
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 15-point rounded corners like this:
Text("Round Me") .padding() .background(.red) .cornerRadius(15)
Download this as an Xcode project

You can automatically round the shortest edge fully by using the clipShape() modifier with a Capsule, like this:
Text("Round Me") .padding() .background(.red) .clipShape(Capsule())
Download this as an Xcode project

SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further for less! Get my all-new book Everything but the Code to make more money with apps, get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn Swift Testing, design patterns, and more.