ios - Passing the Object from one ViewController to another -
override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject!) { if segue.identifier == "shoesdetails" { let indexpath = self.table.indexpathforselectedrow() let shoescon:shoestablecontroler = segue.destinationviewcontroller as! shoestablecontroler let shoescategories:repository = arrofrepository[indexpath!.row] shoescon.object = shoescategories } } class shoestablecontroler: uiviewcontroller { var object = [productshoes]() } class productshoes { var product_id : string var product_name : string init(json :nsdictionary) { self.product_id = json["product_id"] as! string self.product_name = json["product_name"] as! string } class repository { var name : string var ids : string init(json :nsdictionary) { self.name = json["category_name"] as! string self.ids = json["id"] as! string } }
i have 3 classes in firstviewcontroller. show data it's done. after that, when user click on specific cell, show data. have created shoestablecontroller , in shoestablecontroller create product class obj. want access this. problem in line in objective c. doing , working perfect in swift know happened:
shoescon.object = shoescategories
override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject!) { if segue.identifier == "shoesdetails" { let indexpath = self.table.indexpathforselectedrow() let shoescon:shoestablecontroler = segue.destinationviewcontroller as! shoestablecontroler let shoescategories:repository = arrofrepository[indexpath!.row] shoescon.object = shoescategories } } class shoestablecontroler: uiviewcontroller { var object : repository? its solve problem have own mistake sorry posting question
Comments
Post a Comment