ios – How to stop the view from moving up when the keyboard shows up


Hi I am struggling to stop the view in the pic below from moving up when the keyboard appears on the screen. I have tried some approaches that I found here such as adding GeometryReader or ignoresafearea but they did not work.

Any hints would be appreciated. Cheers.

    var body: some View {
        ZStack {
            // Set the wallpaper
            Image("image1")
                .opacity(0.9)
  
                ScrollView {
                    VStack {
                        HStack {
                            Text(getTodayDateAndDay())
                            Spacer()
                            if !viewModel.searchWord.isEmpty {
                                Button("Clear") {
                                }}}
                        HStack {
                            Image(systemName: "magnifyingglass")
                            TextField("Search words", text: $viewModel.searchWord) 
                                    }}   
                        .overlay { Capsule() }
                        // End of the search bar
                        // Australian flag
                        Image("image2") 
                        Text("G'day!")
                        Text("Click the button below!")   
                        HStack {
                            Button(action: { seeScore = true
                            }) {
                                Text("Score") }
                            Button(action: { seeWords = true
                            }) {
                                Text("Word List") }
                        Button(action: { chooseNumWords = true
                            }) {
                            Text("Start")

[![The title Page Pic]
[1]: https://i.stack.imgur.com/A6oBc.png

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img