Create a button with the following characteristics.
- Full width.
- A background color with a linear gradient. The gradient colors should come from at least two custom colors that you will create in Assets.xcassets.
- Rounded corners.
- Horizontal padding of 15.
Once the button is created, use it to create a new buttonStyle. I have included some code and instructions below to make this step easier.
Lastly, create 3 buttons in ContentView and apply your new buttonStyle to all 3.
How to make a button style.
- Copy the text below and paste it way down at the very bottom of ContentView.swift, below the preview struct.
struct NMIStyle: ButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
Paste formatting information here.
}
} - Copy (cut and remove) the formatting information from the button that you created and paste it into the NMIStyle (also ButtonStyle) struct that you created in step 1, replacing the text that reads “Paste formatting information here.”
- Apply the ButtonStyle.