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

4. Working with Text

Wally Wang1  
(1)
San Diego, CA, USA
 
Every user interface needs to display information on the screen. While this information can appear in a variety of forms, one common type of information to display on the user interface involves text. If you want to display text on the user interface, you need to define a string to appear in a Text view such as
Text("Hello World")
For greater flexibility, you can store a string in a variable or constant and then use that variable or constant name in a Text view such as
   let myString = "Displays a string variable" ...

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.