TextFieldWithPadding.swift 793 Bytes
//
//  TextFieldWithPadding.swift
//  InterQR-Internship
//
//  Created by Дмитрий Тимофеев on 01.06.2022.
//

import UIKit

class TextFieldWithPadding: UITextField {
    
    var textPaddingForEmail = UIEdgeInsets(
        top: 0,
        left: 22,
        bottom: 0,
        right: 22
    )
    var textPaddingForPhone = UIEdgeInsets(
        top: 0,
        left: 78,
        bottom: 0,
        right: 22
    )
    
    override func textRect(forBounds bounds: CGRect) -> CGRect {
        let rect = super.textRect(forBounds: bounds)
        return rect.inset(by: textPaddingForPhone)
    }

    override func editingRect(forBounds bounds: CGRect) -> CGRect {
        let rect = super.editingRect(forBounds: bounds)
        return rect.inset(by: textPaddingForPhone)
    }
}