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

Creating a reusable slider component

From the course: iOS 14 Development Essential Training

Start my 1-month free trial

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…

Contents