To add a border to a view

  1. Use border modifier (Suitable if the border should be the same shape as the view)

Untitled

  1. Use overlay (If you want your border to have a different border shape than your view)

Untitled

  1. Use ZStack (for more customization)

Untitled