Skip to content

Instantly share code, notes, and snippets.

@mitnick78
Created February 26, 2022 22:39
Show Gist options
  • Save mitnick78/589d46956e995d5b5b9344cd282314db to your computer and use it in GitHub Desktop.
Save mitnick78/589d46956e995d5b5b9344cd282314db to your computer and use it in GitHub Desktop.
import SwiftUI
struct CardView: View {
@StateObject var vmLearn: LearnViewModel
@State private var isDescription = false
var body: some View {
ZStack{
RoundedRectangle(cornerRadius: 10).stroke(Color(hex: "E5E6E4"), lineWidth: 1)
VStack(spacing: 20){
HStack{
Text(vmLearn.word)
Spacer()
Image(systemName: "info.circle.fill")
.foregroundColor(Color(hex: "957FEF"))
.font(.system(size: 20))
.onTapGesture {
isDescription = true
}
Image(systemName: "play.rectangle.fill")
.foregroundColor(Color(hex: "957FEF"))
.font(.system(size: 20))
}
HStack{
Text(vmLearn.word2)
}.hLeading()
}
.padding(10)
.hLeading()
.popover(isPresented: $isDescription) {
Text("Je suis une description")
Button {
print("d")
self.isDescription = false
} label: {
Text("Fermer")
}
}
}
.onAppear(perform: {
vmLearn.getLearns()
print(vmLearn.learns)
})
.background(Color.white)
.fixedSize(horizontal: false, vertical: true)
.padding([.leading, .trailing],20)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment