Question: I come here with a very very strange error.

I have 3 View controllers in my storyboard.

1) Main Page with list of products `ViewController` 

2) Single Product Detail `ProductViewController`

3) Barcode scanner `BarcodeViewController`

In the MAIN and PRODUCT DETAIL `ViewController`, i have a button saying "Scan Barcode" on top.

I first coded the button of "`Scan Barcode`" in the `ViewController` and segue it to the `BarcodeViewController`. It works perfectly.

For the same Scan Button in `ProductViewController`, i coded it differently. 
I drag the button to EXIT. So that the `ViewController` loads again and as soon as it is loaded i programmatically load the Barcode scanner.

It does not work.
There is no error, there is no crash, nothing. **Even Prepare for segue function is called**. It goes into the right block everywhere.
Just the `BarcodeViewController` dont show up.

The code in ViewController

```
@IBAction func returned (segue: UIStoryboardSegue) {

    NSLog("Returned Segue \(segue.identifier)")

    if ( segue.identifier == "unwindToMainViewViaBarcode" )
    {
        dispatch_async(dispatch_get_main_queue(), {
            self.performSegueWithIdentifier(self.segueIdentifierForBarcode, sender: nil)
        });
    }
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    NSLog("PrepareForSegue \(segue.identifier)")

    if ( segue.identifier == segueIdentifierForBarcode )
    {
        // Reset barcode String
        barcodeString = ""

        // get reference for ViewController and set as a var
        let destination = segue.destinationViewController as! BarcodeViewController
        destination.mainView = self;
        print("open barcode called")
    }

}

```

Answer: 
U can refer so some answer in this [SO Answer](https://stackoverflow.com/questions/27483881/perform-push-segue-after-an-unwind-segue)

Basically make a `BOOL` before perform unwind segue and check it at `ViewDidAppear`, if its set then perform segue from there and turn the `BOOL` to `false`
I found the problem.
In other projects it is working because I am showing segue Modally
Here i by mistake was just showing it.

Now that i have changed it to show as Modal
It is working fine.