April 2020
Beginner
316 pages
8h 20m
English
This has been a lot to take in so far, but you're doing great. Just one more piece of the puzzle to solve now... yep, you guessed it! Let's add the Save button to tie it all together!
We'll start by adding another Button() to our form. Add the following highlighted code at the end of the Form() just after the picker view and underneath the navigationBarTitle():
} // Closing Form Brace.navigationBarTitle("Add Recipe").navigationBarItems(trailing: Button(action: { self.saveRecipe() self.presentationMode.wrappedValue.dismiss() }) { Text("Save") })
Here, we've created a new button that will sit just outside of our form and give it a Text View labeled Save. As part of the button's action, we've added a call to two functions:
Read now
Unlock full access