Skip to content

SwiftUI: Slider

Slider is one way user could get the value through dragging. One great example of the slider example you could see is, a slider that shows the duration of video on YouTube.

In this tutorial, you’ll learn what it takes to build a Slider in SwiftUI. You’ll learn:

  • How to create a basic slider.
  • How to customize slider.


To follow along this tutorial, you’ll need some basic knowledge in:

  • A basic familiarity with Swift.
  • At least Xcode 11

Basic Slider

To create a basic slider that will return any value when you drag the slider.

Customized Slider

Perhaps the color blue doesn’t look as appealing. You may change that with accentColor.

Border shouldn’t sound too bad in this case.

Image would definitely make the slider look even better.

What if you would like the image to be below the slider. That is definitely doable.

Where to go From Here

If you feel like you are ready to take on more challenges, feel free to check out some other tutorials that we have created:

Published inSwiftUI

One Comment

  1. luis luis

    Hi how I can do an animation of the number when you just finish sliding . In Uikit is easy, but I can’t do it SwiftUI.

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © DaddyCoding 2020.