ios - Transferring JSON variable between Classes -


i managed json variable in variable in new class through following function:

class gamesoverview: interface, uitableviewdatasource, uitableviewdelegate{      override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject!) {         if (segue.identifier == "presentgame") {             var presentgame = segue.destinationviewcontroller as! game;             presentgame.gamestate = self.gamestate;             println(presentgame.gamestate);          }     } } 

however when run viewdidload in next class variable self.gamestate not yet filled. filled 2nd time enter class:

class game: interface{      override func viewdidload() {         super.viewdidload();         println(self.gamestate!);     } } 

why isn't self.gamestate! filled @ first time? , how fix this?


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -