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