The source code shown in the Assistant Editor for "ViewController.swift" is different than source code shown in Main Editor for "ViewController.swift".
"ViewController.swift" in Main Editor
:
// ViewController.swift
// FoodTracker
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
// MARK: Properties
@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var mealNameLabel: UILabel!
@IBOutlet weak var mainButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
nameTextField.delegate = self
}
// MARK: UITextFieldDelegate
func textFieldShouldReturn(textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
func textFieldDidEndEditing(textField: UITextField) {
mealNameLabel.text = textField.text
}
// MARK: Actions
@IBAction func setDefaultLabelText(sender: UIButton) {
mealNameLabel.text = "DEFAULT text"
// mainButton.tintColor = UIColor.darkTextColor()
}
}
"ViewController.swift" in Assistant Editor
:
//
// ViewController.swift
// FoodTracker
import UIKit
internal class ViewController : UIViewController, UITextFieldDelegate {
@IBOutlet weak internal var nameTextField: UITextField!
@IBOutlet weak internal var mealNameLabel: UILabel!
@IBOutlet weak var mainButton: UIButton!
override internal func viewDidLoad()
internal func textFieldShouldReturn(textField: UITextField) -> <<error type>>
internal func textFieldDidEndEditing(textField: UITextField) -> <<error type>>
@IBAction internal func setDefaultLabelText(sender: UIButton) -> <<error type>>
}
So, those are completely different different files, but have the same name. The one in the Assistant Editor
is the interface while the file shown in the Main Editor
is the implementation of the interface, right?
That seems a little weird, but the interface and implementing class have the same name? When I'm working in Xcode I need to be aware that sometimes two files can (often?) have the same name?