Pass data from one View Controller to another when button is pressed

28 views Asked by At

This is a macOSX Cocoa Swift question, not iOS.

I have two view controllers [ViewController] & [SecondView].

The [SecondView] has a button with a string value attached. I want to be able to push the button and have the string value populate in my NSTextField on my [ViewController].

Example: (SecondView)

@IBAction func repair(_ sender: Any) {
        solution.stringValue += "Repair needed"

BUTTON PRESSED - pass string to [ViewController

@IBOutlet weak var solution: NSTextField!
0

There are 0 answers