From the course: iOS 14 Development Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Creating a reusable slider component
From the course: iOS 14 Development Essential Training
Creating a reusable slider component
- [Instructor] Now let's create a second new Swift UI view and use that to hold the whole Hstack and it's padding. That way, we can really easily create red, green, and blue sliders. So highlight this code from Hstack down to padding, press command + X on your keyboard to cut it, then press command + N on your keyboard to create a new Swift UI view just like we did before and hit next. Make sure you're saving in the right folder. And we're going to call this ColorSliderView, and then hit return to create the view. Highlight the text, "hello world", and then paste over it. We also want to delete this struct right here for the preview. The reason for doing that is this file is going to be a little bit more complicated than the last file. So we can just focus on building it here and we can preview it from the content view. So, here we have our color swatch and our slider and we're getting an error now because of this red…
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
-
-
-
-
-
-
(Locked)
Getting text input with SwiftUI4m 45s
-
(Locked)
Using a slider in SwiftUI5m 26s
-
(Locked)
Creating a slider with a color swatch2m 38s
-
(Locked)
Making a custom SwiftUI view5m 22s
-
(Locked)
Creating a reusable slider component4m 54s
-
(Locked)
Increasing reusability in custom views3m 13s
-
(Locked)
Challenge: Build a color picker app1m 19s
-
(Locked)
Solution: Build a color picker app1m 17s
-
(Locked)
-
-