SwiftUI_visionOS_Note

TextEditor()

Jan 15, 2024
  • It allows for multi-line text input
  • We can allow users to add multiple lines of text
    • fits for features like user profile bios
 

1. Add a Text Editor in VStack

 

2. Bind the empty string to TextEditor

 

3. Add a button, and change the default string value

 

4. Add a height to textEditor

  • by default, textEditor has maxHeight of infinity
 
  • Add a spacer after the button
 

5. Save text under the button

  1. Create empty string of var
 
  1. Add a empty string text under the button
 
  1. Bind the savedText to textEditorText under the button action
 
 

6. Customize TextEditor

 
 
 

You might also like

BlogPro logo
Made with BlogPro