From the course: Introducing App Development for iOS 14

Unlock the full course today

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

Creating a slider in SwiftUI

Creating a slider in SwiftUI

From the course: Introducing App Development for iOS 14

Start my 1-month free trial

Creating a slider in SwiftUI

- [Instructor] Our next step is to create the slider. Remember the slider's going to use binding as well and it's going to be bound to this tip percent. When we create the slider, one of the things we have to decide is the value range of the slider. So what's the minimum value and what's the maximum value? And how do we want to step between those values? So you might want it to only display values that are whole numbers. So we'll take a look at doing that too. So find your placeholder for your slider and just delete it and type slider and an open parenthesis. And there's a whole bunch of different values right here. And the one that we want is just value in step. And there isn't really an option here, so we're going to just choose one of the ones that has step in it, and then we'll delete the last value. So the value is a binary floating point number that's binding, and our state variable tip percent fits that. So type a…

Contents