This post is for anyone else out there that may run into this problem. I created a custom storyboard segue to dismiss a view controller presented modally.

My custom segue code is extremely simple:

import Foundation
import UIKit

class DissmissSegue : UIStoryboardSegue {

   override func perform() {
      if let viewController = self.sourceViewController as? UIViewController {
         viewController.presentingViewController?.dismissViewControllerAnimated(true) { }
      }
   }

}

Correspondingly, the storyboard looks something like this:

Custom segues

The image above shows the two custom segues circled in red. When either the Done or Cancel buttons are pressed the modal should be dismissed. However, I kept experiencing a crash when either button was pressed. Logically, I put breakpoints in my code in an attempt to figure out what was happening.

Turns out my custom perform method was never getting called. This was a bit of a head scratcher and it took a bit of time to figure it out. If you are seeing this issue make sure your segue is specifying which Segue Module to use in the inspector pane of the storyboard.

Screen shot 2015 01 11 at 7.11.47 pm