Skip to content

Auto-sized FormattingTextField doesn't respect clear button and/or right/left views #8

@ivedeneev

Description

@ivedeneev

Example 1

Screenshot 2024-03-01 at 10 36 24
  • textfield is constrained horizontally to screen bounds
  • textfield has constrained height
       let fixedWidthPhoneField = PhoneTextField() 

        fixedWidthPhoneField.font = .systemFont(ofSize: 30)
        fixedWidthPhoneField.formattingMask = "+7 (###) ###-##-##"
        fixedWidthPhoneField.exampleMask = "+7 (123) 456-78-90"
        fixedWidthPhoneField.textAlignment = .center
        fixedWidthPhoneField.clearButtonMode = .whileEditing

Example 2

Screenshot 2024-03-01 at 10 41 10
  • textfield is using intinsicContentSize to calculate its size
       let adaptiveWidthPhoneField = PhoneTextField() 

        adaptiveWidthPhoneField.font = UIFont(name: "Courier", size: 24)
        adaptiveWidthPhoneField.formattingMask = "+7 (###) ###-##-##"
        adaptiveWidthPhoneField.exampleMask = "+7 (___) ___-__-__"
        adaptiveWidthPhoneField.clearButtonMode = .always

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions