Post

Replies

Boosts

Views

Activity

Reply to Detect end of transition?
Taken and edited from this Stackoverflow. Use coordinator.animate to determine when the animation is over. class ViewController: UIViewController {    public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) coordinator.animate(alongsideTransition: { (context) in guard let windowInterfaceOrientation = self.windowInterfaceOrientation else { return } if windowInterfaceOrientation.isLandscape { // activate landscape changes } else { // activate portrait changes } }) } private var windowInterfaceOrientation: UIInterfaceOrientation? { return UIApplication.shared.windows.first?.windowScene?.interfaceOrientation } }
Oct ’22