Padding

Padding alone will give you decent spacing between your views. If you keep the edge and length parameters nil, the system will calculate the amount of space applied to all the edges.

Image for post

Image for post

Code result — padding


Spacer

Spacer adds flexible spacing that expands along its container’s axis. Inside HStack, the spacing will be horizontal. Inside VStack, it will be vertical. If the Spacer is not contained in a stack, then the system will add spacing to both axes.

#swiftui #swift #programming #mobile #ios

How to Avoid Using Constant Values With SwiftUI
4.20 GEEK