UINavigationController's popViewController(animated:) should be marked @discardableResult

Originator:SaagarJha28
Number:rdar://26984511 Date Originated:23-Jun-2016 03:56 PM
Status:Duplicate/26847289 Resolved:29-Jun-2016 00:17 AM
Product:iOS SDK Product Version:Xcode 8.0 beta (8S128d), Xcode 8.0 Toolchain (Swift 3)
Classification:UI/Usability Reproducible:
 
Summary:
Not sure where to post this, so apologies if it this isn't where it goes.

UINavigationController's popViewController(animated:) method currently returns a UIViewController?, but often it isn't used; the method is used simply to remove the current view controller from the navigation stack. I'd like it if it was marked @discardableResult so I wouldn't have to do something like _ = navigationController?.popViewController(animated: true).

Steps to Reproduce:
Write something like:
navigationController?.popViewController(animated: true)

Expected Results:
No warning because popViewController(animated:) should be @discardableResult

Actual Results:
A warning due to an unused result.

Version:
Xcode 8.0 beta (8S128d), Xcode 8.0 Toolchain (Swift 3)

Notes:
A "regression" due to the acceptance of SE-0047 for Swift 3.

Configuration:
iOS 10 Build Target

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!