ios – VStack Leading alignment doesnt work with nested Text Views


This is how my VStack is defined here:

VStack(alignment: .leading, spacing: 1) {
    Text("entry.titleAlert hajdfg dgfhds fghjds gfhjdsg fhjdsg2")
        .frame(maxWidth: .infinity)
        .multilineTextAlignment(.leading)
        .font(.caption)
        .padding(5)
        .background(Color(uiColor: .alertNews))
   

    Text("entry.contentAlert jhdsg fdhjsgf dhjsgf dhjsgf jdhsgf jdhsgf jdhsgf jdhsgf dhjsgf dhjsgf hdsgfh dghjf gsdhjgf dhjsgf dhjsgf dhjsg fjdhsg fjhdsgf jhdsgf jdhsgf dhjsgf jdhsgfhjdsg fhdsg fgdsjgfdhjs gfjdhsgf hs")
        .frame(maxWidth: .infinity)
        .multilineTextAlignment(.leading)
        .font(.caption)
        .opacity(0.7)
        .lineLimit(5)
        .padding(5)
        .background(Color(uiColor: .alertNews))
    Spacer()
}
.frame(maxWidth: .infinity, alignment: .leading)

and the effect is the following:

Why is it not left aligned?

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img