I am using perform(aSelector: , with: , afterDelay: , inModes: )
to pause an animation after a specified delay. However, I keep getting an Unrecognized Selector Error. I am not sure what could possibly be causing this.
Sample Code (Updated):
class ExpandingSelectedLayer: CALayer, CAAnimationDelegate
{
let expandingAnim = CABasicAnimation(keyPath: #keyPath(CALayer.bounds))
expandingAnim.perform(#selector(expandingAnim.pauseAnim), with: nil, afterDelay: 2.0, inModes: [RunLoopMode.commonModes])
}
extension CABasicAnimation
{
@objc func pauseAnim()
{
print("called pause Anim")
self.speed = 0
}
}