Skip to content

Commit

Permalink
Merge pull request #86 from apptekstudios/master
Browse files Browse the repository at this point in the history
Ensure willDisappear closure is called before removing contentView
  • Loading branch information
huri000 authored Aug 18, 2018
2 parents 8e18267 + 8487c08 commit 1ec36cd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/Infra/EKContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ class EKContentView: UIView {
func removePromptly(keepWindow: Bool = true) {
outDispatchWorkItem?.cancel()
entryDelegate?.changeToInactive(withAttributes: attributes, pushOut: false)

// Execute willDisappear action if needed
self.contentView.content.attributes.lifecycleEvents.willDisappear?()
removeFromSuperview(keepWindow: keepWindow)
}

Expand Down Expand Up @@ -666,6 +669,8 @@ extension EKContentView {
UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 4, options: [.allowUserInteraction, .beginFromCurrentState], animations: {
self.translateOut(withType: type)
}, completion: { finished in
// Execute willDisappear action if needed
self.contentView.content.attributes.lifecycleEvents.willDisappear?()
self.removeFromSuperview(keepWindow: false)
})
}
Expand Down

0 comments on commit 1ec36cd

Please sign in to comment.