add form to create a simple world
This commit is contained in:
1 parent
326baad745
commit
9c1bfe2024
2 files changed
+50
-1
No files matched your search
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// CreateWorldView.swift
|
||||
// WorldBuilder
|
||||
//
|
||||
// Created by Giovanni Josserand on 01/09/2026.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CreateWorldView: View {
|
||||
@State private var worldName = ""
|
||||
@State private var worldDescription = ""
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section("Informations") {
|
||||
TextField("Nom du monde", text: $worldName)
|
||||
|
||||
TextField(
|
||||
"Description",
|
||||
text: $worldDescription,
|
||||
axis: .vertical
|
||||
)
|
||||
}
|
||||
|
||||
Section {
|
||||
Button("Créer le monde") {
|
||||
createWorld()
|
||||
}
|
||||
.disabled(worldName.isEmpty)
|
||||
.padding(.horizontal, 24)
|
||||
.padding(.vertical, 12)
|
||||
.background(Color.blue)
|
||||
.foregroundStyle(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
}
|
||||
.listRowBackground(Color.clear)
|
||||
}
|
||||
.navigationTitle("Créer un monde")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
||||
private func createWorld() {
|
||||
print("Création du monde : \(worldName)")
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import SwiftUI
|
||||
|
||||
struct HomeView : View {
|
||||
var body: some View {
|
||||
Text("Home")
|
||||
NavigationLink("Créer un monde"){
|
||||
CreateWorldView()
|
||||
}.buttonStyle(.glass)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user