Last active
June 3, 2020 13:14
-
-
Save ahmedk92/7f4e25261cd2671f1e96ece8c3587952 to your computer and use it in GitHub Desktop.
Add padding to UIStackView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIStackView { | |
var padding: NSDirectionalEdgeInsets { | |
get { | |
isLayoutMarginsRelativeArrangement ? directionalLayoutMargins : .zero | |
} | |
set { | |
isLayoutMarginsRelativeArrangement = true | |
directionalLayoutMargins = newValue | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credits: https://useyourloaf.com/blog/adding-padding-to-a-stack-view/