Skip to content

Commit

Permalink
πŸ› Fix missing experienceDidDisappear for embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaatttt committed Feb 29, 2024
1 parent 0b11c1d commit 0eb1a37
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/AppcuesKit/Presentation/UI/AppcuesFrameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public class AppcuesFrameView: UIView, StateMachineOwning {
isHidden = true
parentViewController?.unembedChildViewController(experienceController)
configureConstraints(isEmpty: true)
completion?()
// Complete async so that experienceController.viewDidDisappear gets called before the state machine moves to .idling
DispatchQueue.main.async { completion?() }
case .fade:
UIView.animate(
withDuration: 0.3,
Expand All @@ -117,7 +118,8 @@ public class AppcuesFrameView: UIView, StateMachineOwning {
self.isHidden = true
self.parentViewController?.unembedChildViewController(experienceController)
self.configureConstraints(isEmpty: true)
completion?()
// Complete async so that experienceController.viewDidDisappear gets called before the state machine moves to .idling
DispatchQueue.main.async { completion?() }
}
)
}
Expand Down

0 comments on commit 0eb1a37

Please sign in to comment.