简体   繁体   中英

XCode 8.2 Can't connect interface builder IBOutlet to swift file

I'm looking for a solution specifically for the issue with a Swift3 UIViewController having IBOutlets defined, but dragging actions from storyboard does not connect them to existing outlets. I can add new outlets, just with different name, and they work (still cant re-connect them later).

I see old solutions for objective-C dealing with headers and source files, but a swift is a single file per class.

Is there a way to fix "can't connect IBOutlet to swift file" issue?

but dragging actions from storyboard does not connect them to existing outlets

I've noticed this too. But it's not a difficult problem. Here's what to do:

Look carefully at the gutter next to the outlet in the code. There is a circle. Drag from that circle (no need for control-drag) to the view in the Interface Builder canvas.

在此输入图像描述

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM