I'm attempting to add a NavigationLink that overlays my view content. I'm able to do this using either overlay or a ZStack. However, I want it to be invisible. When I try to add .buttonStyle(PlainButtonStyle()) to the NavigationLink it no longer works.
The overlay implementation:
VStack(alignment: .trailing, spacing: 0){
// View content
}.minimumScaleFactor(0.5)
.overlay(GeometryReader { geometry in
// Link to control
NavigationLink(destination: ControlView()) {
EmptyView()
}.buttonStyle(PlainButtonStyle())
.frame(width: geometry.size.width,
height: geometry.size.height,
alignment: .center)
.border(.black, width: 1)
})
The ZStack implementation:
ZStack(alignment: .center) {
VStack(alignment: .trailing, spacing: 0){
// View content
}.minimumScaleFactor(0.5)
// Link to control
GeometryReader { geometry in
ZStack(alignment: .center) {
NavigationLink(destination: ControlView()) {
EmptyView()
}.buttonStyle(PlainButtonStyle())
.frame(width: geometry.size.width * 0.5,
height: geometry.size.height * 0.5,
alignment: .center)
.border(.red width: 1)
}.frame(width: geometry.size.width,
height: geometry.size.height,
alignment: .center)
.border(.black, width: 1)
}
}
The main thing I am trying to remove is the button overlay that causes a circle / oval over my view. Is there something else that can be done to remove this?