1

I am a relatively new developer working with swift in Xcode 6.1 beta. I am trying to make a simple application that has 2 text fields: 1 for first name, 1 for last name. When the submit button is pressed, a new window opens and displays the full name.

I have successfully gotten the application to work on a single window, with the result appearing in a third non-editable text field.

However, when I add the second view controller to the storyboard for the new window, make it launch when the button is pushed, and drag the result field into it, the application does not work.

I tried re-linking the field to my ViewController.swift (where all my code is), but it does not show up on automatic. When I open it via manual, I cannot link to the file.

original window: https://i.sstatic.net/C0xui.png

new window: https://i.sstatic.net/XdZ2l.png

Viewcontroller.swift:

import Cocoa class ViewController: NSViewController { @IBOutlet var window: NSView! @IBOutlet weak var first: NSTextField! @IBOutlet weak var last: NSTextField! @IBOutlet weak var output: NSTextField! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func btn(sender: AnyObject) { var first = self.first.stringValue var last = self.last.stringValue if first.isEmpty { self.output.stringValue = "" } else { self.output.stringValue = "Hello, \(self.first.stringValue) \(self.last.stringValue)!" } } override var representedObject: AnyObject? { didSet { } } } 
3
  • Adding an MCVE would help. Commented Sep 19, 2014 at 16:49
  • Forgot to add images, sorry Commented Sep 19, 2014 at 16:50
  • The images are great to show examples of your windows, but you should still include your relevant code in the question itself, preferably after reducing it to the minimal amount necessary to demonstrate your issue. That makes it easy for potential answerers to copy, paste, run, and debug your code. Posting a screenshot of your code makes it harder for potential answerers to help you. Commented Sep 19, 2014 at 16:53

1 Answer 1

1

You have to show assistant window in the menu View > Assistant Editor > Show Assistant Editor

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.