Interactive TabBarController transition cancel doesn't set selectedIndex property

Number:rdar://32135966 Date Originated:05/11/17
Status:Open Resolved:
Product:UIKit Product Version:iOS 10.3
Classification:Enhancement Reproducible:Always
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"

iOS 10.3.1 [14E304]

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.

iPhone 6s

'Tab' was successfully uploaded.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!