Search code examples
iosxcodeswift3xcode-storyboard

Xcode upgrade/Swift 2 to 3 migration broke storyboard outlet connections, how can I fix them all at once?


All of my storyboard connections to my Swift files have been broken by an Xcode upgrade to migrate to Swift 3. Here's a sample screenshot

enter image description here

We can see the circles not filled out. Normally I could fix this by loading the storyboard then going back to the files, but this isn't working now. When I run the app, it crashes with "invalid selector". I've been fixing them one-by-one by dragging new connections to my files, but this is taking an excessive amount of time. Is there a way to repair the connections?

For reference I am now on Xcode 8.3.3, I believe I was on 7 before


Solution

  • It has to do with the new unnamed first-parameter change

    For example, change

    @IBAction func segmentSwitched(sender: UISegmentedControl) {
    

    to

    @IBAction func segmentSwitched(_ sender: UISegmentedControl) {
    

    Reload the storyboard and rebuild