Instance Property

defaultTextAttributes

The default attributes to apply to the text.

Declaration

var defaultTextAttributes: [NSAttributedString.Key : Any] { get set }

Discussion

By default, this property returns a dictionary of text attributes with default values.

Setting this property applies the specified attributes to the entire text of the text field. Unset attributes maintain their default values.

Getting this property returns the previously set attributes, which may have been modified by setting properties such as font and textColor.

See Also

Accessing the Text Attributes

var text: String?

The text displayed by the text field.

var attributedText: NSAttributedString?

The styled text displayed by the text field.

var placeholder: String?

The string that is displayed when there is no other text in the text field.

var attributedPlaceholder: NSAttributedString?

The styled string that is displayed when there is no other text in the text field.

var font: UIFont?

The font of the text.

var textColor: UIColor?

The color of the text.

var textAlignment: NSTextAlignment

The technique to use for aligning the text.

var typingAttributes: [NSAttributedString.Key : Any]?

The attributes to apply to new text being entered by the user.

enum UITextField.BorderStyle

The type of border drawn around the text field.