Search code examples
iosswift3xcode-storyboard

Property with type 'UIBarButtonItem!' cannot override a property with type 'UIResponder?' after changing to Swift 3


I have two buttons declared here:

@IBOutlet var previous: UIBarButtonItem! 
// No error even though its nearly identical

@IBOutlet var next: UIBarButtonItem! 
// contains error Property 'next' with type 'UIBarButtonItem!' 
// cannot override a property with type 'UIResponder?'

This worked fine until I upgraded to swift 3. I tried removing all references and button, relinking using the editor with no luck


Solution

  • You need to change the name of your outlet (and it's connection in your storyboard) from next to nextItem, as the Swift 3 API's forUIResponder now have a next property.