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

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -