Skip to content

SwiftUI: Padding

Padding is one of my favorite when it comes to SwiftUI. I personally find it very tedious having to go back to the XIB to modify the constraint. Now, padding does it all for us. What a good time to be alive!

Pads the view using the specified edge insets.

Apple Documentation

In this tutorial, you’ll learn what is Padding in SwiftUI. You’ll learn:

  • How to use Padding.


To follow along this tutorial, you’ll need some basic knowledge in:

  • A basic familiarity with Swift.
  • At least Xcode 11


Padding automatically adds 16px for each side.

Perhaps the padding is a little too big. You will set the padding to 10px.

Now you change your mind and would like to only have padding on the left.

You change your mind again and would like to have it on the left and right.

You submitted your build to the design team and they rejected the design. They came out with the design but they reject the design. How irony. Well, life has to go on right. So you do something a little different.

Now the design is happy, and you’re happy.

Where to go From Here

If you feel like you are ready to take on more challenges, feel free to check out some other tutorials that we have created:

Published inSwiftUI

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © DaddyCoding 2020.