Search code examples
iosswiftsegueuitabbar

How to pass data between UITabBar in swift


What is the best way to pass data between UITabBar. I know its easy to use prepare for segue but Im not using a story board for this project. thank you in advance.


Solution

  • Depending on the data you want to pass:

    • If it's data to be used only in the destination view controller, you can simply define public properties and assign them on initialization and before presenting.
    • If it's common data which can be used from both source and destination, then it's better to define a third party (Provider, Manager...) which can provide the common data for both.