I try to build an rss reader. On the "adding feed" page, if I tap the "add" button, I hope to check if the feed is successfully added. If it is added, then trigger the unwind segue, and back to the main page. If it is not added, stay in the current page.
I know I can build an IBAction on the "add" button, and check if the feed is added. However there are two requirements I need to meet in order to add a feed.
First, after I parse the url, I need to know if the parse results can generate a feed. To parse the url, I need to use the method defined in the mainViewController.
Second, I need to check if the feed already exists. If this feed already exists, don't add it. To check this, I need to get the feed data from mainViewController.
Currently I use prepareForSegue to pass the data from main viewController to this view. But for the conditional unwind segue, I don't know how to pass the data and check if the feed already exists. Because prepareForSegue is used only when the segue is going to be triggered. If the segue is not triggered, I can't check the condition.
Besides through segue, is there any other ways to pass data from other view?
I don't know objective-C, so it would be better if you can give me some solutions in swift. :)