Passing data between VC

I couldn’t find any documentation about passing data betweetn view controllers. Can you guys share the link? Search engine didn’t help me.

The right way to do it, is by injecting values when responding to prepareForSegue.
For more details, checkout this tutorial series.

I usually default to using delegates. There are some good examples in various tutorials. Thx

I use prepareForSegue to pass data in and, while exit segues are possible, I just don’t like em for some reason. Often I use callback closures to go back. So, when the VC is created:

let vc = BlahBlahViewController(…)
vc.onSelectedItem = { … }

I always prefix my closures with on- just to take advantage of discovery with autocomplete.

This topic was automatically closed after 166 days. New replies are no longer allowed.