-1

I'm a beginner in programming, so got a question. I have an app with 3 viewControllers. First 2 has inputs. So, the question is, how can I pass data from 1st and 2nd VC to the third one? Thanks a lot for help.

1 Answers1

0

Most use segues between each view controller typically (VC#1 >> VC2 >> VC3). If you are doing that, you simply need to declare public properties along the route and pass them.

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "Segue VC #2" {
        if let vc = segue.destination as? SecondViewController {
            vc.property1 = self.propertyToSend
        }
    }
}