UIEdgeInsetsInsetRect’ has been replaced by instance method ‘CGRect.inset(by:)
The error it is pretty self explanatory. You can use it like this: var animationRect = frame.inset(by: UIEdgeInsets(top: padding, left: padding, bottom: padding, right: padding)) or simply var animationRect = frame.insetBy(dx: padding, dy: padding)