© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
W. WangBeginning iPhone Development with SwiftUIhttps://doi.org/10.1007/978-1-4842-7818-5_9

9. Limiting Choices with Toggles, Steppers, and Sliders

Wally Wang1  
(1)
San Diego, CA, USA
 

Ideally, you want to limit the user to select only valid options. That keeps the user from entering invalid data such as spelling out a number (such as thirty-seven) instead of typing out the number (37). Three additional ways to restrict the user into selecting only valid data are toggles, steppers, and sliders.

A Toggle gives users exactly two choices such as on or off, yes or no, true or false. Because a Toggle only offers two choices, it represents a Boolean value (true or ...

Get Beginning iPhone Development with SwiftUI: Exploring the iOS SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.