0

I want to pass data from firstViewController -> secondNavigationcontroller -> secondTabBarController -> secondViewcontroller.

I can pass it to my navigationcontroller like this:

if segue.identifier == "StartMatchSegue" {
    if let destination = segue.destination as? SecondNavigationController {
        destination.delegate = self as? UINavigationControllerDelegate
        destination.testString = "lets play"
    }
}

but I cant figure out how to pass it all the way.

storyboard

1
  • Once you starting to want to do this you need to look into a more comprehensive data model for you app rather than just passing things around everywhere. Commented Jan 11, 2018 at 19:06

2 Answers 2

1

You could also create a singleton which can be accessed within each view controller.

Sign up to request clarification or add additional context in comments.

Comments

0

You can pass data in different ways two of them i have mentioned below.

  1. NotitificationCenter
  2. Closure

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.