Reputation: 191
Problem:
Within a button I have states which do different things for example hide the tools and the navigation but for some reason I can't show the pencil panel after these views are hidden, any ideas?
@State var showPencilPanel:Bool = false
@Binding var showTools:Bool
@Binding var navOpen:Bool
Button(action: {
self.showTools = false
self.navOpen = false
self.showPencilPanel = true
})
{
VStack {
Spacer()
Image("Text Btn").resizable().renderingMode(.original)
.frame(width: 24, height: 24)
Text("Text").font(.system(size: 10.0)).foregroundColor(.black)
Spacer()
}
}
.position(x: 60, y: 640)
}
ZStack {
Color.white.opacity(0).edgesIgnoringSafeArea(.all)
VStack (alignment: .center) {
//Show Pencil
if self.showPencilPanel {
MyCanvas(canvasView: canvasView, selectedImage: Binding(get: { selectedImage }, set: { selectedImage = $0 } ))
}
}
Upvotes: 0
Views: 92
Reputation: 1256
Maybe you should use .zindex
for that
MyCanvas(canvasView: canvasView, selectedImage: Binding(get: { selectedImage }, set: { selectedImage = $0 } ))
.zindex(5)
https://developer.apple.com/documentation/swiftui/view/zindex(_:)
Upvotes: 1