Animating changes to presentingViewController during interactive dismissal
<p>I'm working on a UIPresentationController subclass similar to Mail.app's open draft behavior.  When a view controller is presented, it doesn't go all the way to the top and the presenting view controller scales down as if it were falling back.</p>

<p>The basic gist of it is below:</p>

<pre><code>class CustomPresentationController : UIPresentationController {

    // Create a 40pt space above the view.
    override func frameOfPresentedViewInContainerView() -&gt; CGRect {
        let frame = super.frameOfPresentedViewInContainerView()
        let insets = UIEdgeInsets(top: 40, left: 0, bottom: 0, right: 0)
        return UIEdgeInsetsInsetRect(frame, insets)
    }

    // Scale down when expanded is true, otherwise identity.
    private func setScale(expanded expanded: Bool) {

        if expanded {
            let fromMeasurement = presentingViewController.view.bounds.width
            let fromScale = (fromMeasurement - 30) / fromMeasurement
            presentingViewController.view.transform = CGAffineTransformMakeScale(fromScale, fromScale)
        } else {
            presentingViewController.view.transform = CGAffineTransformIdentity
        }

    }

    // Scale down alongside the presentation.
    override func presentationTransitionWillBegin() {
        presentingViewController.transitionCoordinator()?.animateAlongsideTransition({ context in
            self.setScale(expanded: true)
        }, completion: { context in
            self.setScale(expanded: !context.isCancelled())
        })
    }

    // Scale up alongside the dismissal.
    override func dismissalTransitionWillBegin() {
        presentingViewController.transitionCoordinator()?.animateAlongsideTransition({ context in
            self.setScale(expanded: false)
        }, completion: { context in
            self.setScale(expanded: context.isCancelled())
        })
    }

    // Fix the scaled view's frame on orientation change.
    override func containerViewWillLayoutSubviews() {
        super.containerViewWillLayoutSubviews()
        guard let bounds = containerView?.bounds else { return }
        presentingViewController.view.bounds = bounds
    }
}
</code></pre>

<p>This works fine for a non-interactive presentation or dismissal.  When performing an interactive dismissal, however, all animations on <code>presentingViewController.view</code> run non-interactively.  That is, the scaling will happen in the ~300ms it normally takes to dismiss rather than staying at 3% complete when 3% dismissed.</p>

<p>You can see this in <a href="https://github.com/bnickel/interactive-parent-transform-bug" rel="nofollow">a sample project is available on GitHub.</a> and <a href="https://www.youtube.com/watch?v=BRbH0GauCt4" rel="nofollow">a video of the issue is on YouTube</a>.</p>

<p>I've tried the following approaches but they all yield the same result:</p>

<ul>
<li>A parallel animation as seen above.</li>
<li>Animating in the UIViewControllerAnimatedTransitioning.</li>
<li>Using a CABasicAnimation an manually adjusting the timing of the container view's layer.</li>
</ul>