You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
}
})
}
The text was updated successfully, but these errors were encountered:
waelsaad
changed the title
I needed to add a delegate for when animation is done self.delegate?.didFinishAnimation()
I needed to add a delegate or a completionHandler for when animation is done self.delegate?.didFinishAnimation()
Jun 22, 2020
waelsaad
changed the title
I needed to add a delegate or a completionHandler for when animation is done self.delegate?.didFinishAnimation()
I needed to add a delegate or a completionHandler for when animation is done
Jun 22, 2020
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.
The text was updated successfully, but these errors were encountered: