Home > OS >  Even if I align text, it is not set to left aligned
Even if I align text, it is not set to left aligned

Time:01-20

I am trying to align left text in Text component in Swift UI.

aling text

As you can see on above image I applied with below code but does not work. Anything missing?

Text(titleSring).frame(alignment: .trailing).background(Color.red)

CodePudding user response:

A frame alignment is for entire view (which is square), you need multi-line text alignment, like

Text(titleSring)
    .multilineTextAlignment(.leading)
  •  Tags:  
  • Related