import SwiftUI struct SplitAppView: View { @State var amount: String = "100.0" @State var tip: Double = 0.0 @State var people: Int = 1 @State private var selectedCurrency: String = "EUR" private let currencies = ["EUR", "USD", "GBP", "JPY"] private var formattedAmount: String { // Formatiere den Betrag als Währung let numberFormatter = NumberFormatter() numberFormatter.numberStyle = .currency numberFormatter.currencyCode = selectedCurrency if let amountDouble = Double(amount) { return numberFormatter.string(from: NSNumber(value: amountDouble)) ?? "" } return "" } // enum Tip: Double, CaseIterable, Identifiable { // case 0.0,.10,0.15,0.20 // var id: Double { self.rawValue } // } var body: some View { VStack { TextField("Betrag", text: $amount) .keyboardType(.decimalPad) .textFieldStyle(RoundedBorderTextFieldStyle()) .padding() } // Picker("Währung wählen:", selection: $selectedCurrency) { // ForEach(currencies, id: \.self) { currency in // Text(currency).tag(currency) // } // } // .pickerStyle(MenuPickerStyle()) // .padding() Text("Check-out") Form { TextField("Summe", text: $amount) .keyboardType(.decimalPad) // Picker("Tip", sources: Tip, selection: $tip) // .keyboardType(.decimalPad) // .pickerStyle(.segmented) Stepper("split between \(people)", value: $people, in: 1...10) // Button("Split") { // split = (total + (total * tip / 100.0)) / Double(people) // } } } } #Preview { SplitAppView() }