Rounded Corners in SwiftUI
Rounding corners on a View in SwiftUI is as easy as adding one line:
.cornerRadius(<corner radius value>)
And if you’re the type of monster who wants to turn anti-aliasing off on your rounded corners for some reason, there’s a bool for that:
.cornerRadius(20, antialiased: false)
That's it!
And since cornerRadius
is available on the View protocol you can tack it on to any View and you've got rounded corners.