From the course: iOS 14 Development Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Creating a slider with a color swatch

Creating a slider with a color swatch

From the course: iOS 14 Development Essential Training

Start my 1-month free trial

Creating a slider with a color swatch

- [Instructor] So let's say we wanted to turn what we have here into a color picker application. So we want to have red, green and blue sliders, and have each of them change the color of the controller appropriately. We're going to be doing that later for the challenge, but to prepare for that, we're going to make a couple of changes here. One is it would be nice if we had some kind of indicator of what this slider does in the user interface. So we're going to take an HStack, and in it we'll put a red swatch next to the slider. Then we're going to take that red swatch object with the slider and create its own UI object with SwiftUI. So, the first thing is to wrap the slider in an HStack, just like that, something that we've done several times so far. Remember to use the curly braces, and I tab the Slider in so it's easier to read the code. And then above the Slider, I'm going to create a red circle. In Swift UI to make…

Contents