SwiftUI: How To Draw Borders With Rounded Rectangles

In SwiftUI, itโ€™s easy to find out there is a .border modifier, and a .cornerRadius modifier. However, those tools canโ€™t create borders with rounded corners. Instead, you can use the .overlay modifier with a RoundedRectangle shape:

Text("dA Snippets")
    .padding()
    .overlay(
        RoundedRectangle(cornerRadius: 16)
            .stroke(Color.pink, lineWidth: 2)
    )