Reputation: 150
I'm trying to add an IBOutlet in swift but I only have the option to add an action.
Here is an image of what I'm talking about.
]
Is there any way I can fix this?
I can't change connection type either.
Upvotes: 2
Views: 1228
Reputation:
You should use the same class in your view controller (call it View Controller.swift)
Upvotes: 0
Reputation: 623
This is happening because you are trying to connect an outlet from the Interface Builder to a non-corresponding View Controller file, so that's why it only gives you the option to add an Exit action. Just make sure that you are in the same View Controller both in the IB and in the Assistant Editor.
P.S. I recommend you renaming properly every view controller so it will be easier to avoid this (make sure to change the name not only in the class but also in the IB). You can use the cmd + click when selecting the class name on the code and click on Rename...
to change all at once. If you already changed it in your code, you have also to do it then manually in the IB, selecting the corresponding one from the drop-down menu of the Identity Inspector:
Upvotes: 5
Reputation: 894
Simply change the connection type or one more thing you can do. you can do this. By opening connection inspector and drag the outlet into view controller like shown in image..
To Change Connection Type
Upvotes: 0