-1

Whenever i tried to run my code in XCode 13 getting warning and build failed

Warning message: 'UIEdgeInsetsEqualToEdgeInsets' is deprecated: Use == operator instead

extension UIButton {
    
   
    open override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
        if UIEdgeInsetsEqualToEdgeInsets(self.touchAreaEdgeInsets, .zero) || !self.isEnabled || self.isHidden { //Getting warning here
            return super.point(inside: point, with: event)
        }
        
        let relativeFrame = self.bounds
        let hitFrame = relativeFrame.inset(by: self.touchAreaEdgeInsets)
       // let hitFrame = UIEdgeInsetsInsetRect(relativeFrame, self.touchAreaEdgeInsets)
        
        return hitFrame.contains(point)
    }
   
}
steveSarsawa
  • 1,559
  • 2
  • 14
  • 31

1 Answers1

1

It's pretty obvious. You are going to check both parameters for equality. So just replace

if UIEdgeInsetsEqualToEdgeInsets(self.touchAreaEdgeInsets, .zero) 

with

if self.touchAreaEdgeInsets == .zero
vadian
  • 274,689
  • 30
  • 353
  • 361