I use Xcode 7.2
I can use Control+drag to swift file to create a @IBOutlet
But I can't drag @IBOutlet in swift file to storyboard. Here I don't use any other key, just drag.
Actually when I moving mouse to the spot before @IBOutlet, nothing happened and when I trying to drag it a breakpoint added.
1.I`m sure I use the right Class name
2.My project is not in a strange path or name
The behavior has changed in new versions of Xcode (I'm not certain but it might have been since 7+.). Older versions of the product might still have the gutter shortcut working.
Now you have to either open the Connections Inspector or right-click on the view controller in the Document Outline. Once open, drag from the defined IBOutlet to your UIView subclass (UIButton, UITextField, etc...)
Search your local help for: Interface Builder Connections Help: Creating an Outlet Connection. You will find these are the only methods that now work. The gutter shortcut does not work.
Nota Bene:
You can confirm this behavior and other changes to Xcode shortcuts by choosing the following menu Help > Xcode Overview and taking a look at Part V: Building a User Interface , section Connecting Objects In Code .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.