Very nice library, I was just a bit suprised because the library didn't have a delegate that is triggered when the animation is complete. I am hoping something like this could be added so I can integrate the library using Swift Package Manager.
/**
Use this method for force dismiss controller. By default it call automatically.
*/
@objc public func dismiss() {
UIView.animate(withDuration: 0.2, animations: {
self.alpha = 0
self.transform = self.transform.scaledBy(x: 0.8, y: 0.8)
}, completion: { finished in
self.delegate?.didFinishAnimation()
self.removeFromSuperview()
})
}
or adding a completionHandler
public func present(completionHandler: @escaping (() -> Void)) {
haptic.impact()
keyWindow.addSubview(self)
layoutIfNeeded()
layoutSubviews()
alpha = 0
transform = transform.scaledBy(x: 0.8, y: 0.8)
UIView.animate(withDuration: 0.2, animations: {
self.alpha = 1
self.transform = CGAffineTransform.identity
}, completion: { _ in
if let iconView = self.iconView as? SPAlertIconAnimatable {
iconView.animate()
}
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + self.duration) {
self.dismiss(completionHandler: completionHandler)
}
})
}
Hi,
Very nice library, I was just a bit suprised because the library didn't have a delegate that is triggered when the animation is complete. I am hoping something like this could be added so I can integrate the library using Swift Package Manager.