A padding modifier in SwiftUI takes an EdgeInsets
, eg
.padding(.leading, 8)
However, there are only leading and trailing EdgeInsets, and not left and right. This presents a problem because not everything in RTL languages should necessarily be reversed from the way it's displayed in LTR languages.
Is there a way to achieve the same or similar effect as the padding modifier, which forces the padding to be on left or right side, regardless of directionality of the language?
struct ContentView: View {
var body: some View {
Text("Hello, SwiftUI!")
.padding(EdgeInsets(top: 10, leading: 20, bottom: 10, trailing: 20)) // Apply custom padding values
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With