1

I have recently been developing an app for Apple Watch using SwiftUI. I have integrated NavigationView and embedded another View into it. This embedded view has got few buttons, which I can't figure out how to size properly. The top row is overlapped by navigation bar. Is there some workaround how to size it properly? I have tried using Text instead of button and with it it works fine.

This is structure of my main view:

    NavigationView {

        ScrollView(.vertical) {

            NavigationLink(destination: InputView()) {
                Text("Click here to get view")
            }
        }
    }

This is structure of InputView:

var body: some View {
    NavigationView {
        VStack(spacing: 0) {
            ForEach(0..<4) { rowIndex in
                HStack {
                    ForEach(0..<3) { columnIndex in
                        let buttonID = rowIndex*3 + columnIndex
                        
                        Button("\(buttonID)") {
                            print(buttonID)
                        }
                    }
                }
            }
        }
    }
}

Here's an image that shows the functionality

Text

Pepa
  • 41
  • 6
  • You only need 1 NavigationView at the very top, remove all the rest – lorem ipsum Feb 02 '23 at 17:45
  • You are right, thank you, however the issue still persists. Half of the top row buttons still get hidden under the navigation bar. – Pepa Feb 02 '23 at 17:49

0 Answers0