Unwind segue doesn't work
<p>i'm doing an app that uses a TableViewController with a system of Adding/Editing items, using the same view. (however when you add an item the view is modal presented and when you edit it is shown)</p>

<p>I followed the great <a href="https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson9.html#//apple_ref/doc/uid/TP40015214-CH9-SW1" rel="nofollow noreferrer">starter tutorial</a> from Apple so basically my Storyboard looks like this</p>

<p><a href="https://i.stack.imgur.com/mRYwy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mRYwy.png" alt="storyboard"></a> </p>

<p>The segue going through the Navigation Controller is for adding and the other one is for editing. (I did everything according to the tutorial).</p>

<p>I did a segue between the Cancel item bar button and the exit icon of the ViewController and it works well when the view is modally presented (when I try to add an item).</p>

<p>However when I click on a cell to reach the view with the segue that shows it (to edit an item), both items in the navigation bar stop working. The <code>prepareForSegue</code> method is not called anymore. So I can't cancel or save.</p>

<p>I tried creating an unwind segue between the ViewController itself and the exit icon and to call it programmatically like this:</p>

<pre><code>@IBAction func testButton(sender: UIBarButtonItem) {
    print("we're inside")
    self.performSegueWithIdentifier("cancelSegue", sender: self)
    print("so what now")
}
</code></pre>

<p>and when I try to edit it and tapping the cancel button it results by just showing the two log messages and kind of skipping the <code>performSegueWithIdentifier</code> method. However adding still works fine.</p>

<p>Am I doing something wrong or have I misunderstood some basic notion about unwind segues?</p>