Reputation: 35
I'm having a repeating problem in Xcode and would like to ask for help/advice.
Have been creating a new class, FirstViewController, which is a subclass of UIViewController. When I go to the Identity Inspector to layout the .xib file, so that I can layout my objects and make my connections.
But FirstViewController doesn't show up in the dropdown list for Custom Class in Identity Inspector.
What am I doing wrong, and what can I do to fix this?
Thanks in advance.
I have tried to clean and rebuild project, highlight File owner and then choose Custom Class, restart Xcode, and restart my computer... but to no avail!
Upvotes: 1
Views: 2481
Reputation: 2755
The problem with me was that the storyboard view was a table view controller , but the class does not inherit from the UIViewController .
Just make sure that your view has the right inheritance class as the same storyboard view .
Upvotes: 0
Reputation: 3016
Hi and welcome to Stack Overflow.
One possibility is that you don't have your ViewController's File's Owner selected when you open up your Identity Inspector. Example:
Notice how Custom Class in Identity Inspector is blank! And I just created FirstViewController and checked the "create XIB" box. What gives? Well on the left I have the UIView selected instead of file's owner.
Now look at this:
This time I have file's owner selected on the left. And now on the right Custom Class in Identity Inspector says it's FirstViewController.
If you select file's owner in Interface Builder then go to the Identity Inspector there you'll find your class that you want to connect to your VC.
To see this list on the left make sure to click the button that expands this window. It's right here:
Upvotes: 2
Reputation: 131426
In general what you do is this:
(Note that this is an Xcode/IB question, and in no way specific to Swift.)
Upvotes: 0