0

Why the Text for Date takes so much space.

var body: some View {
    VStack{
        HStack(alignment: .top, spacing: 0) {
            VStack{
                Text(entry.date, style:.relative)
            }
            .background(Color.yellow)
            Text("ago")
        }
        
        .font(.system(size: 12))
        .foregroundColor(.gray)
    }.padding()
}

enter image description here

I would like to display the ago static text right after the dynamic date Text element in HStack

Kesong Xie
  • 1,316
  • 3
  • 15
  • 35

1 Answers1

0

I can simply do this:

Text("\(entry.date, style: .relative) ago") and there is no need for a HStack

Kesong Xie
  • 1,316
  • 3
  • 15
  • 35