From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

SwiftUI gradients

SwiftUI gradients

- [Instructor] One way to make your application look more professional is to use gradients. In in SwiftUI, they're very easy to do with a few interesting wrinkles. Let's take a look. I have a SwiftUI project set up here. To make our work easier for this video, I made a pallette of color constants which I can find up here. Now you will find a rectangle I also made. And it's using the edgesIgnoringSafeArea. So what that'll do is you can see that I've set this to an iPhone 11 Pro Max. It'll catch the entire area here of the screen. If I take it out, you'll see that it leaves the edges there. I can make a gradient in one of two ways; initializing gradient object within an array of color or of color stops. So at its simplest, what I'm going to do is just two colors; white and blue. Let gBackground equals the gradient object. And again, here I got colors and stops. I'm going to use colors to start with. And for the…

Contents