Unable to connect IBOutlet from storyboard to UIView subclass
We see this issue sometimes too since Xcode 8
, and assume this is a Xcode bug.
As a workaround:
Write the outlet in code
@IBOutlet weak var myUiElement: UIView!
Ctrl + Drag from your outlet to the UI element in the Storyboard
Create an outlet like this in Objective-C
@property (nonatomic, weak) IBOutlet UIView *view;
or as in swift 3
@IBOutlet weak var instruction: UILabel?
and then connect it as given in this image.
Sometimes the normal way of connecting action and outlet doesn't work due to subclassing. This way comes handy for such situations.
Its basic, but easy to overlook. Make sure the view controller you are dragging the outlet to is labeled as the custom class you created.
After trying some of the given solution what finally worked is by restarting the my macbook. It seems like a bug on XCode's side. Oh well.