I have an Swift app. To make padding I wrote this code:
class TextField: UITextField {
let padding = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 5)
override open func textRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds, padding)
}
override open func placeholderRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds, padding)
}
override open func editingRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds, padding)
}
But today I converted my project to Swift 4.2 and now I have an error:
'UIEdgeInsetsInsetRect' has been replaced by instance method 'CGRect.inset(by:)'
How can I fix it?