1

In iOS13 VStack align its content center along the vertical direction, like this:

enter image description here

In iOS14 VStack align its content top along the vertical direction:

enter image description here

I use same code as below,

GeometryReader { geometry in
    VStack(alignment: .leading, spacing: 0) {
        ForEach(0 ..< 100) { i in
            Text("Row \(i)").foregroundColor(.white)
        }
    }
}

How to make the VStack align its top edge in iOS13?

pawello2222
  • 46,897
  • 22
  • 145
  • 209
Dictator
  • 105
  • 1
  • 9
  • It is not VStack, it is GeometryReader. I don't see why do you need it here - consider removing GeometryReader. ... or describe which layout do you want to achieve. – Asperi Oct 10 '20 at 08:11
  • The code in my question is the smallest demo code, I do need GeometryReader to set vstack child view' height. Besides, same code produces different UI apparently, is this a bug? – Dictator Oct 10 '20 at 08:28
  • 1
    See [GeometryReader Discrepancies with Previous OS Versions](https://swiftui-lab.com/geometryreader-bug/) – pawello2222 Oct 10 '20 at 10:02
  • @pawello2222 Having seen that and it solved my problem, thanks – Dictator Oct 10 '20 at 13:02

0 Answers0