© 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_8

8. Limiting Choices with Pickers

Wally Wang1  
(1)
San Diego, CA, USA
 

Text Fields are great for letting the user enter any type of information such as names or short answers to questions. The problem is that if the user has the freedom to enter anything, they could accidentally (or on purpose) enter invalid data.

For example, if a Text Field asks for an address, you want the user to have the freedom to type anything. However, if a Text Field asks for a state, language, or gender, you don’t want the user to type “dog,” “1258dke3,” or “I am looking for shoes” because none ...

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.