I am studying Swift! I want create Main interface on xib. But have error \"use of unresolved identifier\".
Add code from MainViewController
1) Right Click your MainViewController.swift
2) Select Show File Inspector
3) On Right side panel, look at Target Membership
4) Add your class to target by check the box :)
Just a tip for those who found this question with this issue like mine.
This issue tortured me for days!
You likely didn't add the class to the target. Click on the MainViewController
class and open the utilities tab on the upper right corner in Xcode:
Make sure the appropriate target is checked.
EDIT: Apparently you don't have target membership there - which is bizarre in and of itself. Try re-creating the MainViewController
class from scratch and make sure the correct target is selected:
This same issue happened with me too. I've only one target membership and still, I was getting “use of unresolved identifier”. I build the project and nothing changed.
I tried to uncheck and recheck the target membership and the issue was resolved.
If this doesn't resolve your issue, try building the project, check for typo error or use autocompletion and Quick Help to find recognized identifiers.