ios - Swift: didSelectItemAtIndexpath function not work of json -


i have 3 controller. in first categorycollectionviewcontroller, next listtableviewcontroller , has descriptioncollectionviewcontroller. in controllers passed json data perfectly. got no idea code should write in didselectrowat_indexpath function of listtableviewcontroller.

the first categorycollectionviewcontroller

override func collectionview(_ collectionview: uicollectionview, didselectitemat indexpath: indexpath) {      let controller1 = listtableview()     controller1.product_id = arrcategory[indexpath.item].id!     navigationcontroller?.pushviewcontroller(controller1, animated: true) } 

** categorycollectionviewcontroller json web file** enter image description here

the second listtableviewcontroller

override func tableview(_ tableview: uitableview, didselectrowat indexpath: indexpath) { 

tell me please code have write here push viewcontroller

} 

listtablecontroller , descriptioncollectionviewcontroller's json web file same

just different product_image value have load in listtableviewcontroller's cell , all_images value have load in descriptioncollectionviewcontroller's cell.

enter image description here

you have write code pushing view-controller after setting storyboard id:

override func collectionview(_ collectionview: uicollectionview, didselectitemat indexpath: indexpath) {     let controller1 = self.storyboard?.instantiateviewcontroller(withidentifier:"listtableview") as! listtableview     navigationcontroller?.pushviewcontroller(controller1, animated: true) } 

i assuming storyboard id same controller class name can set storyboard id in storyboard -> identity inspector.

note:- replace identifier in case of push view controller that:

let controller1 = self.storyboard?.instantiateviewcontroller(withidentifier:"descriptioncollectionviewcontroller") as! descriptioncollectionviewcontroller  

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -