Rounded Corners in SwiftUI

RoundedCorners.png

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.

Previous
Previous

Fonts in SwiftUI

Next
Next

Learn How to Create Lists in SwiftUI