I did extensive googling on the matter, perhaps I am unable to find the right keywords, so no luck identifying a solution. Perhaps someone here may help.
I have 3 Viewcontrollers - Master, Detail and TaskEditViewController.
I am posting local notifications that fire up a method on Detail VC, which is supposed to unwind to Master and then fire up a method that would segue to TaskEditViewController.
What happens is that first I get the segue animated from Detail to TaskEditViewController (they have no segue on storyboard), and after that the unwind happens and goes to Master.
Here's my code on Detail VC (the one receiving the notification):
func editFromNotification(notification: NSNotification) {
print("Add New Task Screen received")
if let notifId = notification.object!["notifId"] as? String {
taskIdToSend = notifId
selectedTask = getTaskForSelectedId(notifId)
self.performSegueWithIdentifier("sendNotificationToMaster", sender: nil)
}
}
And here's the method that gets fired up from the unwind segue on Master VC:
@IBAction func unwindAndProcessNotification(segue:UIStoryboardSegue) {
if(segue.sourceViewController .isKindOfClass(Detail)) {
let viewSource:Detail = segue.sourceViewController as! Detail
let receivedTaskId = viewSource.taskIdToSend
print("Task sent to open is: \(receivedTaskId)")
selectedTask = getTaskForSelectedId(receivedTaskId)
performSegueWithIdentifier("showEditScreen", sender: nil)
}
}
If anyone can shed some light on the matter, the behaviour I get is a complete mystery for me...