Reputation: 23
I have a label that shows the amount of gold in ViewController1. If the user makes a purchase in the in-game-store in ViewController2, how can I update the labels text in ViewController1?
Basically, how can i change the label text from anoter viewController? Thanks,
Upvotes: 0
Views: 161
Reputation: 385
In vc2 create closure something like this
var actionBuy:(()->())?
when action tapped use this actionBuy?()
it called in vc1
vc2.actionBuy = {
label.text = "action is done"
}
.
good luck
Upvotes: 1