Member-only story
Displaying Borders in SwiftUI
Displaying borders around views in SwiftUI is easy, and this post shows how to draw borders that are simple, rounded, or have another shape.
SwiftUI makes it quite easy to create beautiful user interfaces. That fact becomes even bolder when it comes to apply simple styling to views, as many times a single line of code is enough to do the job. Drawing borders confirms that statement, as we can achieve nice results with almost no effort at all. This post demonstrates how to display simple borders around views, as well as how to create more complicated and configurable borders.
Displaying a simple border around a view is just a matter of calling a view modifier. The following code illustrates that by adding a border around a text view. Note that specifying the desired color for the border is mandatory: