0
votes

My SwiftUI View is pushed up by the keyboard despite using the .ignoresSafeArea(.keyboard) modifier:

import SwiftUI

struct PushUpView: View {
    @State var random = ""
    
    var body: some View {
        ZStack(alignment: .top) {
            Color.clear
            VStack {
                ForEach(0..<25) { id in
                    Text("Text: \(id)")
                }
                TextField("Hello, World!", text: $random)
                Spacer()
            }
        }
        .ignoresSafeArea(.keyboard)
    }
}

Pursuant to the following threads:

I thought that by using Spacer(), and by putting the keyboard avoid-er on a ZStack that has a Color.clear background that takes up all available space I'd be safe.

Alas, the problem persists. What am I doing wrong?