public struct Frontside: View
{
@Binding public var id: Int
@Binding public var sheet: Bool
@Binding public var rotate: Bool
public var body: some View
{
ZStack{
RoundedRectangle(cornerRadius: 8, style: .continuous)
.foregroundColor(backgroundColours[tangoArray[self.id].jlptColour ?? 0])
.frame(width: 140, height: 149)
.zIndex(0)
VStack {
Text(tangoArray[self.id].kanji)
.font(.system(size: 24))
.foregroundColor(textColours[tangoArray[self.id].jlptColour ?? 0])
.fontWeight(.regular)
.padding(25)
.lineLimit(3)
.truncationMode(.tail)
.zIndex(1)
Spacer()
}
VStack {
Spacer()
HStack {
Button(action: {
incorrect(i: self.id)
checkAttempts()
self.id = nextCard()
if justFinishedRevising {
self.rotate.toggle()
justFinishedRevising = false
}
if justFinishedLearning {
self.rotate.toggle()
self.sheet = true
justFinishedLearning = false
}
}) {
Image(systemName: "xmark")
.font(.headline)
.opacity(0.4)
}
Button(action: {
correct(i: self.id)
checkAttempts()
self.id = nextCard()
if justFinishedRevising {
self.rotate.toggle()
justFinishedRevising = false
}
if justFinishedLearning {
self.sheet = true
justFinishedLearning = false
}
}) {
Image(systemName: "circle")
.font(.headline)
.opacity(0.4)
}
}
}
.zIndex(2)
}
}
}
I have a view which is a flashcard. When the user taps on the incorrect button I want the flash card to slide to the left of the screen, and when the user taps on the correct button I want the flash card to transition/slide to the right of the watch screen. How do I do that?