My problem is that i have a textfield on my viewcontroller which should be get filled by user and to provide options to fill the textfiled there is a arrow button front of textfield. Clicking on it open a new viewcontroller with a list of options. So when the user click on any option from that viewcontroller the data will automatically fill in that textfield and user return on previous viewcontroller. And i can not use preprefor segue in it so please provide an answer. If i am missing something let me know i ll comment or edit.
Have a look at the unwind segue approach. This is a good way to set a value from one view controller as it returns to the initial view controller.
1 Like
You say that clicking on the arrow shows a new view controller with a list of options for the text field. To show a new view controller you’re creating it then displaying it - why can’t you populate a list of options by setting an array of String to a var on that view controller before displaying it? Getting the option filled in the textfield should be as simple as having the first view controller be a delegate of the second with a function defined to take the selected option and fill the textfield before the options view controller is dismissed.