2021年3月14日星期日

How can I left-justify Text objects inside of a DisclosureGroup?

I have the following view:

struct ContentView: View {      @State private var showItems = false      var body: some View {          DisclosureGroup("Show items", isExpanded: $showItems){              ForEach(0 ..< 10){i in                  Text("\(i)")              }          }      }  }  

But I am unsure of how to have the Texts centered once the DisclosureGroup is expanded. I have tried the .frame(alignment: .leading) view modifier as well as wrapping the Group in a VStack(alignment: .leading), both to no effect. How do I get the text left-justified? I am using Xcode 12.4 with Swift 5.3.2.

Thank you.

https://stackoverflow.com/questions/66631354/how-can-i-left-justify-text-objects-inside-of-a-disclosuregroup March 15, 2021 at 09:41AM

没有评论:

发表评论