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
From the course: iOS 14 Development Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Getting text input with SwiftUI4m 45s
-
Using a slider in SwiftUI5m 26s
-
Creating a slider with a color swatch2m 38s
-
Making a custom SwiftUI view5m 22s
-
Creating a reusable slider component4m 54s
-
Increasing reusability in custom views3m 13s
-
Challenge: Build a color picker app1m 19s
-
Solution: Build a color picker app1m 17s
-
-
-