Post

Replies

Boosts

Views

Activity

Can't figure out why Toolbar is not conforming to view
ToolbarItem in group is not conforming to view for some reason, here's my code: 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() } } } } } The error reads: Static method 'buildExpression' requires that 'ToolbarItem<(), Button>' conform to 'View' I'm trying to change it up but I can't get past this error for some reason
2
0
231
Jul ’24