in Swift how to get an outlet to work

Good day,

I am just learnning Swift and from the beginning i want everything to work otherwise it's not going to work on biger projects

.

but I do understand what is going on I just can't get the X-Code to get unstuck from where it is.

the outlet is not being reconized to make the conection to the code and I did my research and even put the code in-place ,

before, making the conection yet, it did not work.



it would be in the section on "Create Outlets for UI Elements", 'Outlets'


Then on Step (#6) it shows to add a line of code below the class line ;


// MARK: Properties
  1. then you are to add the conection wiht a control+drag on the
    ViewController.swift
    . sheet .
  2. Also you can add a line of code under the //MARK Properities and it looks like this;

         @IBOutlet weak var nameTextField: UITextField!


So as, you see I do understand what need to happen I just must be missing a step.


Thank-you for any help,

Brian


I am using the Apple website for instructions so it has all the data layed out very good.


https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson3.html#//apple_ref/doc/uid/TP40015214-CH22-SW1


Thankyou,

Brian Helip

Replies

Simply creating an outlet in code DOES NOT connect that outlet to the actual control

on your storyboard. For that, you need to link them by either right clicking and selecting

the outlet that object is linked to or control dragging to the code that it should be linked

to.

  • Need help with this same issue. Your solution isn’t working. Is there another one?

Add a Comment

The 'food tracker' tutorial from Apple is broken. Search here for previous discussion, solutions, etc.