drag and drop @iboutlet

Hi to everyone,

I have a trouble in Xcode, when i try to do "drag and drop " from storyboard to viewcontroller.swift to insert an @iboutlet, the system doesn't do it.

Replies

Have you set the Custom Class in the identity inspector for the view controller?


(Also I am assuming by "drag and drop" you actually mean control-drag, which is how IB connects outlets / actions / constraints... if you are actually just doing a click & drag without the control key, don't do that 🙂 )

I'm experiencing the same problem.

  • Started with tabbed Swift application, with 2 tabs;
  • Added an additional View Controller & Bar Button Item; all 3 tabs work
  • Added a UITableView to each View Controller
  • Did ctrl+click+drag from the UITableView to the _ViewController.swift to insert the @IBOutlet code for the 2 original tabs -- works fine
  • Did ctrl+click+drag from the UITableView (on the 3rd tab/ViewController) to the corresponding _ViewController.swift, but the @IBOutlet code does not insert.


Why doesn't the @IBOutlet code get inserted?

  • Me too having this problem

  • Me too having this problem

  • @mksmurali most common cause is that the class in IB of the viewController is not set to the one where you try to drag and drop. Check in Identity Inspector. You may also have to do a Clean Build Folder and possibly restart Xcode.

Add a Comment