Looking for help merging two controllers in the same file

Hi,

I'm super sorry if this is a silly question - I've literally only just gotten into swift and am learning! Basically, I'm making a Mac App where you select 'submit' from one page (Page A), and it opens up another page (page B). I need to be able to write code for page B but as it is in the same controller file as Page A I can't seem to merge the two together.

Here's my code:

Code Block
import Cocoa
class ViewController: NSViewController {
  @IBOutlet weak var enternamehere: NSTextField!
    
    @IBOutlet weak var welcomemessage: NSTextField!
    override func viewDidLoad() {
        super.viewDidLoad()
 
    }
    override var representedObject: Any? {
        didSet {
        // Update the view, if already loaded.
        }
    }
    @IBAction func submit(_ sender: Any) {
        var name = enternamehere.stringValue
        if name.isEmpty {
          name = "person without a name"
        }
        let greeting = "Hello \(name)!"
        welcomemessage.stringValue = greeting
        
    }
}
// Here is where I guess I need to reference Page B?


I have included a link here - h ttps://i.imgur.com/lu2oEbu.png to a screenshot of my Xcode in case my question is confusing.

Thanks guys! :)

Answered by HarryStanford in 671280022
Thread closed.
Accepted Answer
Thread closed.
Looking for help merging two controllers in the same file
 
 
Q