NOOB question about swift 4 and building iOS applications
I am starting to learn swift for developing an iOS app I have come from the world of .net and C# so I admit I am a bit more used to a different way of development
I have not learnt all the proper terms yet so please be patient.
I am following along to this https://developer.apple.com/library/archive/referencelibrary/GettingStarted/DevelopiOSAppsSwift/ConnectTheUIToCode.html#//apple_ref/doc/uid/TP40015214-CH22-SW1
Now I have followed the code to drop buttons and labels onto the storyboard
In the guide it talks about use Ctrl + Drag to create references to objects within the .swift files
Doing a ctrl + Drop seems like a pain so what I wanted to do was create the references in the swift file manually
So I dropped a new UILabel and UIButton controls on the storyboard, set Identified values
Then in the swift files I tried to add the controls and an touch event
@IBOutlet weak var labelOne: UILabel!
@IBOutlet weak var buttonOne: UIButton!
@IBAction func setLabelOneText(_ sender: Any) {
labelOne.text = "Default Text";
}
i.e. I based this on what was placed in the swift file from the Ctrl + Drop code
However nothing worked.
Going back to the sample code, i then updated the working button tap event to also update the text of the label added manually, but it is throwing errors.
Is the only way to reference objects in a swift file to Ctrl + Drop them into the swift file? As coming from a C# world, if I dropped a control onto a WPF app, I would be able to automatically reference it in the code behind file and not have to worry about additional steps to be able to access the control.
I am using the latest version of xcode and swift 4.