I have a text box in Swift with a background colour applied. However, the background covers some of the text as seen here
I want there to be some space between the text and the border of the background colour.
Here is my current code
Text(newData3)
.foregroundColor(.gray)
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.yellow).frame(width: 400, alignment: .center)
.cornerRadius(30)
.padding(10)
I'm new to Swift so I'm not sure what to try. Any help would be much appreciated.
Try this approach of adding the .padding(10)
before the other modifiers, specifically before the .background(...)
, like this:
Text(newData3).padding(10)
....
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