summaryrefslogtreecommitdiff
path: root/ShedCalc/ParamView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'ShedCalc/ParamView.swift')
-rw-r--r--ShedCalc/ParamView.swift41
1 files changed, 41 insertions, 0 deletions
diff --git a/ShedCalc/ParamView.swift b/ShedCalc/ParamView.swift
new file mode 100644
index 0000000..3e27978
--- /dev/null
+++ b/ShedCalc/ParamView.swift
@@ -0,0 +1,41 @@
+//
+// ParamView.swift
+// ShedCalc
+//
+// Created by Jacky Jack on 28/07/2026.
+//
+
+import SwiftUI
+
+
+struct ParamView: View {
+ //@StateObject private var viewModel = ParamModel()
+ @Environment(ParamModel.self) var paramModel
+
+ var body: some View {
+ @Bindable var paramModel = paramModel
+ VStack {
+ HStack {
+ Text("All in meters")
+ }
+ HStack {
+ Text("Width")
+ TextField("Width", value: $paramModel.width, format: .number)
+ }
+ HStack {
+ Text("Height")
+ TextField("Height", value: $paramModel.height, format: .number)
+ }
+ HStack {
+ Text("Length")
+ TextField("Length", value: $paramModel.length, format: .number)
+ }
+ HStack {
+ Text("Total floor area: \(paramModel.floorArea(), specifier: "%.2f") m^2")
+ }
+ HStack {
+ Text("Total roof area: \(paramModel.roofArea(), specifier: "%.2f") m^2")
+ }
+ }
+ }
+}