UIViewControllerTransitionCoordinator's animateAlongsideTransition doesn't work as expected

Originator:bhatnagar.anurag
Number:rdar://28918184 Date Originated:10/24/2016
Status:Open Resolved:
Product:iOS Product Version:10
Classification:UI/Usability Reproducible:Always
 
Area:
UIKit

Summary:
Calling animateAlongsideTransition within presentationTransitionWillBegin creates an animation that seems to be the reverse of what is expected. I used a UIVisualEffectView with a UIBlurEffect that I wanted to fade is as I present a view controller. However, the view comes in with full opacity and then fades out, and at the end of the presentation, appears on the screen abruptly again.

-(UIVisualEffectView *)blurEffectView{
    if(!_blurEffectView){
        UIVisualEffect * blurEffect     = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
        UIVisualEffectView * effectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
        _blurEffectView                 = effectView;
    }
    return _blurEffectView;
}

-(void)presentationTransitionWillBegin{
    UIView * containerView        = self.containerView;
    UIVisualEffectView * blurView = self.blurEffectView;
    blurView.frame                = containerView.bounds;
    [containerView addSubview:blurView];
    blurView.alpha = 0;
    
    id<UIViewControllerTransitionCoordinator> transitionCoordinate = [[self presentingViewController] transitionCoordinator];
    [transitionCoordinate animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
        blurView.alpha = 1;
    } completion:nil];
}

-(void)presentationTransitionDidEnd:(BOOL)completed{
    if(!completed){
        [self.blurEffectView removeFromSuperview];
    }    
}

Steps to Reproduce:
1. Present a view controller (animated) and present another view that fades in alongside with transition

Expected Results:
The view transitions along side the view controller being presented

Actual Results:
The view comes on the screen as soon as animation begins, fades out, and then abruptly appears on the screen again

Version:
iOS 10.0

Notes:
Only appears to be on iOS 10 and iOS 10.1 beta

Configuration:
iPhone 5s, 6, 6Plus

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!