![]() Draw segue from VC1 to VC2 and give identifier string ' InputVCToDisplayVC' to segue. ![]() Using segue (PrepareForSegue) steps : VC1 -> VC2 But in general practise, to pass data from VC1 to VC2 (Forward data passing), we use segue and from VC2 to VC1(Backward data passing), we use protocol - delegate way.ฤก. For both cases, we can use segue to pass data. Highlight one of your first View Controller by clicking somewhere near the top of it (above the status bar, but not on the 3 icons in the center of the top. We will create the class for the second View Controller by adding a Cocoa Touch class file to our project. We want to pass data from VC1 to VC2 and some times VC2 to VC1. 1) Using StoryBoard Segue Storyboard segues are very much useful for passing data in between Source and Destination View Controllers and vice versa also. Here I am adding some of the best approaches of it. Let's assume we have 2 viewcontroller named VC1 and VC2. There are so many approaches for data passing in swift. ![]() This method is triggered by the connected segue when the user taps on the Edit quote button. Click the first view controller in the Document Outline to select it, then delete it. We pass the app state in the prepare (for:sender:) method of QuoteViewController. Through following methods, we can pass data from one viewcontroller to another viewcontroller. Select the UITableViewController and on the top menu, click Editor > Embed In > Navigation Controller. We now need to pass the state between the two view controllers and to update it when the user edits the quote.
0 Comments
Leave a Reply. |