TextView
public class TextView : ScrollViewA scrollable, multiline text region. Wrapper of UITextView
UITextView supports the display of text using custom style information and also supports text editing. You typically use a text view to display multiple lines of text, such as when displaying the body of a large text document. This class supports multiple text styles through use of the attributedText property. (Styled text is not supported in versions of iOS earlier than iOS 6.) Setting a value for this property causes the text view to use the style information provided in the attributed string. You can still use the font, textColor, and textAlignment properties to set style attributes, but those properties apply to all of the text in the text view. It’s recommended that you use a text view—and not a UIWebView object—to display both plain and rich text in your app.
TextView(text: "Hello, World!")
     .height(100)
     .font(size: 20)
     .font(style: .bold)
     .margin(edge: .top, value: 96)
     .backgroundColor(.yellow)
     .cornerRadius(10)
     .didEndEditing { text in
         print("\(String(describing: text))")
     }
     .shouldEndEditing { text -> Bool in
         print("\(String(describing: text))")
         return true
     }
     .didChangeText { text in
         print("\(String(describing: text))")
     }.gesture(gesture: getstur)
     .onTapGesture {
         print("on tap")
     }.onLongPressGesture(numberOfTaps: 1, numberOfTouches: 3) {
         print("on long press")
     }
- 
                  
                  Create a new TextView with specified text string. DeclarationSwift public init(text: @autoclosure @escaping () -> String?)Parameterstexta string value. 
- 
                  
                  Create a new TextView with specified text container. DeclarationSwift public init(textContainer: () -> NSTextContainer?)ParameterstextContainera new text container. 
- 
                  
                  The text that the text view displays. In iOS6 and later, assigning a new value to this property also replaces the value of the attributedText property with the same text, albeit without any inherent style attributes. Instead the text view styles the new string using the font, textColor, and other style-related properties of the class. DeclarationSwift @discardableResult public func text(_ value: @autoclosure @escaping () -> String?) -> SelfParametersvaluea new string value. Return Valueself 
- 
                  
                  The font of the text This property applies to the entire text string. The default value of this property is the body style of the system font. DeclarationSwift @discardableResult public func font(_ value: @autoclosure @escaping () -> UIFont?) -> SelfParametersvaluea new font value Return Valueself 
- 
                  
                  The color of the text. This property applies to the entire text string. The default text color is black. In iOS 6 and later, assigning a new value to this property causes the new text color to be applied to the entire contents of the text view. If you want to apply the color to only a portion of the text, you must create a new attributed string with the desired style information and assign it to the attributedText property. DeclarationSwift @discardableResult public func textColor(_ value: @autoclosure @escaping () -> UIColor?) -> SelfParametersvaluea new color Return Valueself 
- 
                  
                  Change the color the text, the color is created by the rgba value. DeclarationSwift @discardableResult public func textColor(red r: @autoclosure @escaping () -> Int, green g: @autoclosure @escaping () -> Int, blue b: @autoclosure @escaping () -> Int, alpha a: @autoclosure @escaping () -> CGFloat = 1) -> SelfParametersrthe red value of the color object, data range from 0 to 255. gthe green value of the color object, data range from 0 to 255. bthe blue value of the color object, data range from 0 to 255. athe opacity value of the color object, data range from 0 to 1. Return Valuedescription 
- 
                  
                  Change the color of the text, the color is created by the hex and alpha. DeclarationSwift @discardableResult public func textColor(hex: @autoclosure @escaping () -> Int, alpha a: @autoclosure @escaping () -> Float = 1) -> SelfParametershexhex number aalpha value Return Valueself 
- 
                  
                  The technique for aligning the text. See:UITextView.textAlignment This property applies to the entire text string. The default value of this property is NSTextAlignment.natural. Assigning a new value to this property causes the new text alignment to be applied to the entire contents of the text view. If you want to apply the alignment to only a portion of the text, you must create a new attributed string with the desired style information and assign it to the attributedText property. public enum NSTextAlignment : Int { case left = 0 // Visually left aligned case center = 1 // Visually centered case right = 2 // Visually right aligned /* !TARGET_ABI_USES_IOS_VALUES */ // Visually right aligned // Visually centered case justified = 3 // Fully-justified. The last line in a paragraph is natural-aligned. case natural = 4 // Indicates the default alignment for script }DeclarationSwift @discardableResult public func textAlign(_ value: @autoclosure @escaping () -> NSTextAlignment) -> SelfParametersvaluea new test alignment Return Valueself 
- 
                  
                  Set the font of the text, the font is created by the specified name and style. public enum AKFontStyle{ case `default` case bold case italic case bolditalic }DeclarationSwift @discardableResult public func font(name: @autoclosure @escaping () -> String?, style: @autoclosure @escaping () -> AKFontStyle, size: @autoclosure @escaping () -> CGFloat) -> SelfParametersnamefont name stylefont style sizefont size Return Valueself 
- 
                  
                  Change the font name of the text. DeclarationSwift @discardableResult public func font(name value: @autoclosure @escaping () -> String?) -> SelfParametersvaluea new font name. Return Valueself 
- 
                  
                  Change the font size of the text. DeclarationSwift @discardableResult public func font(size value: @autoclosure @escaping () -> CGFloat) -> SelfParametersvaluea new font size. Return Valueself 
- 
                  
                  Change the font style of the text. public enum AKFontStyle{ case `default` case bold case italic case bolditalic }DeclarationSwift @discardableResult public func font(style value: @autoclosure @escaping () -> AKFontStyle) -> SelfParametersvaluea new style Return Valueself 
- 
                  
                  A Boolean value that indicates whether the text view is editable. See: UITextView.isEditable The default value of this property is true. DeclarationSwift @discardableResult public func isEditable(_ value: @autoclosure @escaping () -> Bool) -> SelfParametersvaluea new Boolean value. Return Valueself 
- 
                  
                  A Boolean value that indicates whether the text view is selectable. See: UITextView.isSelectable This property controls the ability of the user to select content and interact with URLs and text attachments. The default value is true. DeclarationSwift @discardableResult public func isSelectable(_ value: @autoclosure @escaping () -> Bool) -> SelfParametersvaluea new Boolean value. Return Valueself 
- 
                  
                  A Boolean value that indicates whether the text view allows the user to edit style information. See: UITextView.allowsEditingTextAttributes When set to true, the text view allows the user to change the basic styling of the currently selected text. The available style options are listed in the edit menu and only apply to the selection. The default value of this property is false. DeclarationSwift @discardableResult public func allowsEditingTextAttributes(_ value: @autoclosure @escaping () -> Bool) -> SelfParametersvaluea new Boolean value Return Valueself 
- 
                  
                  The styled text that the text view displays. See: UITextView.attributedText. Assigning a new value to this property also replaces the value of the text property with the same string data, albeit without any formatting information. In addition, the font, textColor, and textAlignment properties are updated to reflect the typing attributes of the text view. DeclarationSwift @discardableResult public func attributedText(_ value: @autoclosure @escaping () -> NSAttributedString) -> SelfParametersvaluea new NSAttributedString value. Return Valueself 
- 
                  
                  A Boolean value that indicates whether inserting text replaces the previous contents. The default value of this property is false. When the value of this property is true and the text view is in editing mode, the selection UI is hidden and inserting new text clears the contents of the text view and sets the value of this property back to false. DeclarationSwift @discardableResult public func clearsOnInsertion(_ value: @autoclosure @escaping () -> Bool) -> SelfParametersvaluea new Boolean value. Return Valueself 
- 
                  
                  A Boolean value that determines the rendering scale of the text. See: UITextView.usesStandardTextScaling When the value of this property is true, UIKit automatically adjusts the rendering of the text in the text view to match the standard text scaling. When using the standard text scaling, font sizes in the text view appear visually similar to how they would render in macOS and non-Apple platforms, and copying the contents of the text view to the pasteboard preserves the original font point sizes. This effectively changes the display size of the text without changing the actual font point size. For example, text using a 13-point font in iOS looks like text using a 13-point font in macOS. If your app is built with Mac Catalyst, or if your text view’s contents save to a document that a user can view in macOS or other platforms, set this property to true. The default value of this property is false. DeclarationSwift @available(iOS 13.0, *) @discardableResult public func usesStandardTextScaling(_ value: @autoclosure @escaping () -> Bool) -> SelfParametersvaluea new Boolean value. Return Valueself 
- 
                  
                  The current selection range of the text view. See: UITextView.selectedRange In iOS 2.2 and earlier, the length of the selection range is always 0, indicating that the selection is actually an insertion point. In iOS 3.0 and later, the length of the selection range may be non-zero. DeclarationSwift @discardableResult public func selectedRange(_ value: NSRange) -> SelfParametersvaluea range value Return Valueself 
- 
                  
                  The types of data that convert to tappable URLs in the text view. See: UITextView.dataDetectorTypes You can use this property to specify the types of data (phone numbers, http links, and so on) that should be automatically converted to URLs in the text view. When tapped, the text view opens the application responsible for handling the URL type and passes it the URL. Note that data detection does not occur if the text view’s isEditable property is set to true. DeclarationSwift @discardableResult public func dataDetectorTypes(detectorType value: () -> UIDataDetectorTypes) -> SelfParametersvaluea new UIDataDetectorTypes value. Return Valueself 
- 
                  
                  The attributes to apply to new text that the user enters. See: UITextView.typingAttributes This dictionary contains the attribute keys (and corresponding values) to apply to newly typed text. When the text view’s selection changes, the contents of the dictionary are cleared automatically. DeclarationSwift @discardableResult public func typingAttributes(_ value: [NSAttributedString.Key : Any]) -> SelfParametersvaluenew attributes Return Valueself 
- 
                  
                  Scrolls the text view until the text in the specified range is visible. See: UITextView.scrollRangeToVisible DeclarationSwift @discardableResult public func scrollRangeToVisible(_ value: NSRange) -> SelfParametersvalueThe range of text to scroll into view. Return Valueself 
- 
                  
                  The custom input view to display when the text view becomes the first responder. See: UITextView.inputView If the value in this property is nil, the text view displays the standard system keyboard when it becomes first responder. Assigning a custom view to this property causes that view to be presented instead. The default value of this property is nil. DeclarationSwift @discardableResult public func inputView(_ content: () -> View) -> SelfParameterscontentthe content of input view. Return Valueself 
- 
                  
                  The custom accessory view to display when the text view becomes the first responder. See: UITextView.inputAccessoryView The default value of this property is nil. Assigning a view to this property causes that view to be displayed above the standard system keyboard (or above the custom input view if one is provided) when the text view becomes the first responder. For example, you could use this property to attach a custom toolbar to the keyboard. DeclarationSwift @discardableResult public func inputAccessoryView(_ content: () -> View) -> SelfParameterscontentthe content of inputAccessoryView. Return Valueself 
- 
                  
                  The inset of the text container’s layout area within the text view’s content area. See: UITextView.textContainerInset. This property provides text margins for text laid out in the text view. By default the value of this property is (8, 0, 8, 0). DeclarationSwift @discardableResult public func textContainerInset(_ value: UIEdgeInsets) -> SelfParametersvaluenew edge insets. Return Valueself 
- 
                  
                  The attributes to apply to links. See: UITextView.linkTextAttributes. The default attributes specify blue text with a single underline and the pointing hand cursor. DeclarationSwift @discardableResult public func linkTextAttributes(_ value: [NSAttributedString.Key : Any]!) -> SelfParametersvaluenew attributes. Return Valueself 
- 
                  
                  set the callback of which return value determine whether to begin editing in the specified text view. DeclarationSwift @discardableResult public func shouldBeginEditing(_ action: @escaping (_ text: String?) -> Bool) -> SelfParametersactioncallback Return ValueSelf 
- 
                  
                  Asks the callback whether to stop editing in the specified text view. DeclarationSwift @discardableResult public func shouldEndEditing(_ action: @escaping (_ text: String?) -> Bool) -> SelfParametersactioncallback Return Valueself 
- 
                  
                  Tells the callback when editing begins in the specified text view. DeclarationSwift @discardableResult public func didBeginEditing(_ action: @escaping (_ text: String?) -> Void) -> SelfParametersactioncallback Return Valueself 
- 
                  
                  Tells the callback when editing stops for the specified text view, and the reason it stopped. DeclarationSwift @discardableResult public func didEndEditing(_ action: @escaping (_ text: String?) -> Void) -> SelfParametersactioncallback Return Valueself 
- 
                  
                  Asks the callback whether to change the text at the specified range. DeclarationSwift @discardableResult public func shouldChangeText(_ action: @escaping (_ text: String?, _ range: NSRange, _ replacementText: String) -> Bool) -> SelfParametersactioncallback Return Valueself 
- 
                  
                  Tells the callback the text at the specified range had been changed. DeclarationSwift @discardableResult public func didChangeText(_ action: @escaping (_ text: String?) -> Void) -> SelfParametersactioncallback Return Valueself 
- 
                  
                  Tells the callback when the text selection changes in the specified text view. DeclarationSwift @discardableResult public func didChangeSelection(_ action: @escaping (_ text: String?, _ selectedRange: NSRange) -> Void) -> SelfParametersactioncallback Return Valueself 
- 
                  
                  Asks the callback whether the specified text view allows user interaction with the specified URL in the specified range of text. See: UITextViewDelegate DeclarationSwift @available(iOS 10.0, *) @discardableResult public func shouldInteractWithURL(_ action: @escaping (_ text: String?, _ URL: URL, _ characterRange: NSRange, _ interaction: UITextItemInteraction) -> Bool) -> SelfParametersactioncallback Return Valueself 
- 
                  
                  Asks the callback whether the specified text view allows user interaction with the provided text attachment in the specified range of text. See: UITextViewDelegate DeclarationSwift @available(iOS 10.0, *) @discardableResult public func shouldInteractWithTextAttachment(_ action: @escaping (_ text: String?, _ textAttachment: NSTextAttachment, _ characterRange: NSRange, _ interaction: UITextItemInteraction) -> Bool) -> SelfParametersactioncallback Return Valueself 
 TextView Class Reference
      TextView Class Reference