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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -