Interactive TabBarController transition cancel doesn't set selectedIndex property

Originator:joseph.m.mclaughlin
Number:rdar://32135966 Date Originated:05/11/17
Status:Open Resolved:
Product:UIKit Product Version:iOS 10.3
Classification:Enhancement Reproducible:Always
 
Summary:
Using a UIPercentDrivenInteractiveTransition when presenting/dismissing UITabBarController tabs results in inconsistent behavior when relying on selectedIndex{ didSet { …  } } for functionality.

When selecting a different tab programmatically (i.e. `selectedIndex = 1`), the selectedIndex property is given a new value. In addition, when tapping a different tab (not programmatic), the delegate method (tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController)) is called.

However, when calling cancel() on a UIPercentDrivenInteractiveTransition, neither the delegate method or property setter is triggered, but the selectedIndex property *is* reset to it's initial value.

For my use case, it would be nice to rely on the set/didSet to be called whenever a tab is changed. It doesn't seem right that the underlying state of the tab bar should change without causing any (observable) change to the public properties.

Steps to Reproduce:
1. Launch included sample app
2. Begin the interactive gesture by panning from top to bottom
3. Cancel the gesture by releasing your tap close to the tap origin (the threshold for a cancel is 50% progress)

Expected Results:
The latest log line should read "Selected Index: 0"

Actual Results:
The latest log line still reads "Selected Index: 1"

Version:
iOS 10.3.1 [14E304]

Notes:
You can verify that the selectedIndex has indeed been changed to it's initial value by tapping the "Log selectedIndex" button on the first view controller.

Configuration:
iPhone 6s

Attachments:
'Tab Cancel.zip' was successfully uploaded.

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!