ios - How can I pass a variable from one view to another easily? -
so want able pass variable 1 view view easily. i've seen ways doing via segue hoping simpler if possible.
is there way transfer content of 1 variable , save in view easily. aware might not possible.
if isn't possible, please explain how use segue method? i've seen various online tutorials explaining how applying situation. want know bare code , how works apply own situation. way transfer variable 1 view very little knowledge me understand. understand terminology program in other languages swift new me.
i should add coding language using swift.
i appreciate if me this.
thank you
if 1 variable sending, use prepare segue.
override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "identifierofseguegoeshere" { if let destinationvc = segue.destinationviewcontroller as? otherviewcontroller{ destinationvc.dictionary = self.dictionary } } } if passing lot of data, e.g. list of friends etc create singleton class stores them can accessed anywhere.
if passing multiple variables don't have enough of connection create singleton class can put them dictionary , pass dictionary.
Comments
Post a Comment