parent
e799c19d45
commit
6bfe8980f5
@ -1,18 +1,26 @@
|
||||
//
|
||||
// ButtonView.swift
|
||||
// DouShouQi_App
|
||||
//
|
||||
// Created by etudiant on 23/05/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ButtonView: View {
|
||||
var button1Title: String
|
||||
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
VStack {
|
||||
Button(action: {
|
||||
print("\(button1Title) pressé!")
|
||||
}) {
|
||||
Text(button1Title)
|
||||
.frame(width: 200)
|
||||
.padding()
|
||||
.background(Color.red)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(10)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ButtonView()
|
||||
struct ButtonsViewPreviews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ButtonView(button1Title: "Button")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue