I have the following SwiftUI view:
struct Flashcard : View {
@State var cardText = newArray[randomNum].kana
var body: some View {
let stack = VStack{
Text(cardText)
.color(.red)
.font(.title)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 200)
.tapAction {
self.flipCard()
}
HStack {
Button(action: {
print("button pressed")
self.incorrect()
}) {
Image(systemName: "xmark.circle")
.font(.title)
}
.opacity(0.4)
Button(action: {
print("button pressed")
self.correct()
}) {
Image(systemName: "checkmark.circle")
.font(.title)
}
.opacity(0.4)
}
}
//.background(Color.blue)
.cornerRadius(25)
return stack
}I'm trying to make the background colour of the VStack blue, but when I do that, I realise that the Buttons are no longer pressable. Is there a way to make them always on top? Should I be using a ZStack as well to make the Buttons the last view that is added to the stack? I tried using a ZStack but getting a lot of strange outcomes.