Link IBOutlet.

Discussion in 'iOS Programming' started by rich1812, Nov 5, 2018.

  1. rich1812 macrumors regular

    Oct 4, 2015
    Hello, it's been quite a while since I did an iOS app. right now I use xCode 10.1 I follow this tutorial
    One of the most annoyiny things in xcode is linking the buton. In step 2 of the tutorial, it says "
    Control + drag our preview vie to ViewController.swift and create an IBOutlet named previewView". How do I do that? It seems no matter how I control drag, it never create an IBOutlet.
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    You need to have the storyboard and ViewController.swift both visible side by side. Control click on the view in the list of views and drag into the ViewController.swift file inside the ViewController class. You should see a blue line appear indicating where the outlet will be placed. Release the mouse and a little window will appear. Type in the name and close the little window. It should insert the IBOutlet.

    There are other ways to do this but that's probably the most convenient.
  3. grandM macrumors 65816


    Oct 14, 2013
    You can put the storyboard and ViewController.swift next to each other tapping on a button on the right hand top. If another file appears option click on ViewController.swift.

Share This Page