Sorry for late response,
here is the full struct
import SwiftUI
struct addApplicationSheet: View {
@Environment(\.dismiss) var dismiss
@State var companyName: String = ""
@State var role: String = ""
@State var location: String = ""
@State var yearlySalary: Double = 0.00
@State var dateApplied: Date = .now
@State var notes: String = ""
``
var body: some View {
NavigationStack {
Form {
TextField("Company Name", text: $companyName)
TextField("Role", text: $role)
TextField("Location", text: $location)
TextField("Yearly Salary", value: $yearlySalary, format: .currency(code: "USD"))
.keyboardType(.decimalPad)
}
.navigationTitle("Add Application")
.navigationBarTitleDisplayMode(.large)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button("back") {
dismiss()
}
}
ToolbarItem(placement: .navigationBarTrailing) {
Button("Save") {
let appdata = ApplicationData(
companyName: companyName,
role: role,
location: location,
yearlySalary: yearlySalary,
dateApplied: dateApplied,
notes: notes)
// Save the application data
dismiss()
}
}
}
}
}
}
#Preview {
addApplicationSheet()
}
I messed up some of the inline code but that's everything
I'm running Xcode Version 15.3 on Sonoma 14.4.1