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

7. Retrieving Text from Text Fields and Text Editors

Wally Wang1  
(1)
San Diego, CA, USA
 
User interfaces often need to retrieve text from the user. Sometimes, this text can be a single word or short phrase, but other times this text might consist of several paragraphs. To retrieve text from the user, SwiftUI offers three types of views:
  • Text Field

  • Secure Field

  • Text Editor

A Text Field lets the user type in a single line of text such as a name or an address. Optionally, Text Fields can display placeholder text that appears in light gray and is used to explain what type of ...

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.