ios - How to back to previous view controller with parameters in swift -


tableviewcontroller b shows when button in viewcontroller tapped. user selects item in b , led a. used following code go b. how can pass selected item ([int: string]) a?

navigationcontroller?.popviewcontrolleranimated(true) 

below code navigate b a

 let storyboard : uistoryboard = uistoryboard(name: "main", bundle:nil)   let nextviewcontroller = storyboard.instantiateviewcontrollerwithidentifier("categories") as! categorylistviewcontroller   self.presentviewcontroller(nextviewcontroller, animated:true, completion:nil) 

in viewcontroller a class create empty dictionary

var dict = [int: string]()     

now when move tableviewcontroller b viewcontroller a set value dict

let storyboard : uistoryboard = uistoryboard(name: "main", bundle:nil)   let nextviewcontroller = storyboard.instantiateviewcontrollerwithidentifier("categories") as! categorylistviewcontroller  // here pass parameter viewcontroller  nextviewcontroller.dict =  yourvariblewhichstrore[int:string]    self.presentviewcontroller(nextviewcontroller, animated:true, completion:nil) 

Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -