The documentation is very well written :
https://developer.apple.com/documentation/apple_pay_on_the_web/
You can try out Apple Pay transactions on the demo page : https://applepaydemo.apple.com/
Post
Replies
Boosts
Views
Activity
It's really amazing, because in my code I have:
init(carte: Binding<Carte>) {
but when I put the file on the forum it disappears to put only "binding"....
It's really very strange...
Sorry I attached you "CreerUneListeView"
CreeUneListeView.swift
I attached the structs messing.
SentrainerUIView: is empty (no developed)
CreeUneListeView : work
ModifierUneCarte : the design is done, but the modification does not work (I am waiting for the modification of a list to work)
Thanks in advance :-)
SentrainerUIView.swift
ModifierUneListeView.swift
ModifierUneCarte.swift
AjouterUneCarteView.swift
import SwiftUI
struct AfficherUneListe: View {
@Binding var liste : Liste
@Binding var showNavigationBar: Bool
var body: some View {
Spacer()
Text("Les cartes")
.font(.headline)
ScrollView {
LazyVGrid(columns: [GridItem(.adaptive(minimum: 100))], spacing: 5) {
ForEach(liste.cartes) { c in
NavigationLink(destination: ModifierUneCarte(carte: c)) {
VStack {
RoundedRectangle(cornerRadius: 10)
.foregroundColor(.white)
.shadow(radius: 3)
.padding(5) // Ajouter un padding supplémentaire
.overlay(
VStack {
Text(c.devant)
.font(.system(size: 14))
Divider()
Text(c.derriere)
.font(.system(size: 14))
}
)
}
.frame(width: 100, height: 100)
}
}
}
}
.navigationBarItems(trailing: HStack {
Button(action: {
// Code pour le premier bouton
}) {
Image(systemName: "play")
}
Button(action: {
// Code pour le deuxième bouton
}) {
Image(systemName: "trash")
}
})
.navigationTitle(liste.nom)
}
}
struct AfficherUneListe_Previews: PreviewProvider {
static var previews: some View {
let liste = Liste(nom: "Liste 1", cartes: [
Carte(devant: "Avant 1-1", derriere: "Derriere 1-1", dateProchaineRevision: Date()),
Carte(devant: "Avant 1-2", derriere: "Derriere 1-2", dateProchaineRevision: Date()),
Carte(devant: "Avant 1-3", derriere: "Derriere 1-3", dateProchaineRevision: Date())
])
return NavigationView {
AfficherUneListe(liste: Binding.constant(liste), showNavigationBar: Binding.constant(false))
}
}
}
import SwiftUI
struct ModifierUneCarte: View {
@State private var avant = ""
@State private var arriere = ""
@Binding var carte: Carte
var body: some View {
VStack {
TextEditor(text: $avant)
.frame(height: 200)
.padding()
.background(
RoundedRectangle(cornerRadius: 10)
.stroke(Color.blue, lineWidth: 2)
)
.padding()
TextEditor(text: $arriere)
.frame(height: 200)
.padding()
.background(
RoundedRectangle(cornerRadius: 10)
.stroke(Color.blue, lineWidth: 2)
)
.padding()
Button(action: {
carte.devant = avant;
carte.derriere = arriere;
avant = ""
arriere = ""
}) {
Text("Ajouter la carte")
.fontWeight(.bold)
.font(.system(size: 20))
.foregroundColor(.white)
.padding()
.background(
RoundedRectangle(cornerRadius: 10)
.stroke(Color.blue, lineWidth: 2)
.background(
RoundedRectangle(cornerRadius: 10)
.fill(Color.blue)
)
)
}
Spacer()
}
.navigationTitle("Modifier une carte")
}
}
struct ModifierUneCarte_Previews: PreviewProvider {
static var previews: some View {
ModifierUneCarte(carte: .constant(Carte(devant: "Devant", derriere: "Derriere", dateProchaineRevision: Date())))
}
}
And structs :
Carte.swift
Session.swift
Liste.swift
Thanks