What I wish to obtain: when clicking the save button, it pops up a field asking for the title. after person provides a reputation and hits the verify button, it performs some actions and dismisses the view (return to the dad or mum view).
this is my code, nevertheless, it does not carry out any actions after I save and ensure the primary time. All following makes an attempt works. any thought why it does not work for the primary time?
Button(motion: {
self.isShowingNameInput = true
}) {
Textual content("SAVE")
}
.alert("Job Title", isPresented: self.$isShowingNameInput, actions: {
TextField("", textual content: self.$choices.title)
Button(motion: {
log("Saved (self.choices.title)")
self.presentationMode.wrappedValue.dismiss()
}) {
Textual content("Affirm")
}.disabled(self.choices.title.isEmpty)
Button(position: .cancel, motion: {}) {
Textual content("Cancel")
}
}, message: {})