Pass Data between 3 View Controllers

I have a Note-Taking App that helps a User break down there notes based off different areas of that subject.

Details:
3 x View Controllers with a Text Field & “Next” Button

What I’m trying to achieve…

  1. User goes to 1st View Controller and types text into TextField, clicks next button
  2. Does the same for the next View Controller
  3. On the last view controller is shows the user the text they’ve just written in the previous view Controllers.

I’m able to pass it between 2 but not 3. See Code Below.

1ST VIEW CONTROLLER
"
@IBOutlet weak var observationText: UITextView!

public var helloworld: String = ""

override func viewDidLoad() {
    super.viewDidLoad()
            overrideUserInterfaceStyle = .light
            observationText.becomeFirstResponder()

}
@IBAction func Next(_ sender: Any) {
     self.helloworld = observationText.text!
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    let vc = segue.destination as! ApplicationViewController
    vc.helloworld = self.helloworld

"

LAST VIEW CONTROLLER
"
@IBOutlet weak var ObservationLabel: UITextView!

var application: String = ""
var helloworld = ""

override func viewDidLoad() {
    super.viewDidLoad()
            overrideUserInterfaceStyle = .light
    
    ObservationLabel.text = helloworld
}

"

Hope this makes sense and someone able to help me!

Hi,

Do you have

var helloworld:helloworld?

In your receiving viewController, ApplicationViewController?

If memory serves, Xcode squawks if it can not find the member you are trying to pass into.

Blessings,
—Mark

Thank you Mark!

Managed to figure it out by using Var across all view controllers :slight_smile:

Well done! Glad you figured it out!

Blessings,
—Mark