Hey there,
I was following the Developing iOS Apps (Swift) Guide by Apple using Xcode 8.0 beta 6 and ran into a problem while implementing navigation:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if sender === saveButton{
}
}The comparison between the sender object (type Any?) and the saveButton (type UIBarButtonItem!) in this code does not work and yields the following error:
Binary operator '===' cannot be applied to operands of type 'Any?' and 'UIBarButtonItem!'Only possible way to make it work is to downcast the sender object to the UIBarButtonItem class and compare the casted copy to saveButton. Of course, this is easy, but shouldn't the identity operator (===) still work even in Swift 3? As Apple's guide shows, it used to work in the previous version or did I miss anything?
Best wishes and thanks!