0

I have a project in Xcode (I'm relatively new to Swift).

I was adding objects (text fields and labels to my storyboard).

I started connecting the text fields and labels to the code (control+drag). I was able to perform this several times.

Now all of a sudden, I can no longer perform this action (connect an outlet to my code).

Add a screenshot of the error, although it simply looks like all the others posted.

I have closed the project, closed Xcode, deleted the text field (then re-added to storyboard), tried connecting. I have seen suggestions about Rebuilding the project (I have done that and can use the app on the simulator). I have seen suggestions about changing the Custom Class value of the text field, but that doesn't make sense to me and Xcode doesn't appear to allow that.

Somehow I have changed something that I am unaware of what I did. I have been messing with this for about an hour now. I have read many other posts here and on the web, but none of those methods have resolved my issue.

TexanJohn
  • 21
  • 2
  • Have a look at this question: https://stackoverflow.com/questions/29923881/could-not-insert-new-outlet-connection-could-not-find-any-information-for-the-c The only advice is "Have you tried turning it off an on again" as you are not doing any thing wrong here – Razi Tiwana Apr 07 '19 at 17:15

2 Answers2

0

Apparently I needed to delete the "Derived Data" associated with my project.

Xcode -> Preferences -> Locations

Under Derived Data, use/select small arrow at the end of the path name to display the folder in Finder.

Close Xcode.

Then, delete that folder (or project specific).

After doing this, my problem was solved. I don't know what is in "Derived Data".

TexanJohn
  • 21
  • 2
0

Deleting the derived data sure will work. However you may also write the @IBOutlet variable in the code first the same way Xcode creates it and then you should be able to simply connect the outlet to it.

Antonin Charvat
  • 920
  • 9
  • 16
  • I tried that (I think). To connect (after manually adding the Outlet), do you still perform 'control+drag'? If so, that did not work (for me). – TexanJohn Apr 07 '19 at 21:19
  • Yes, that's the point. You add the outlet in the code and control+drag the outlet onto the variable. Why it is not working for you? What happens? – Antonin Charvat Apr 08 '19 at 06:16
  • I get the same error in my screen shot in my original post. To be clear, I resolved my problem by clearing/deleting "Derived Data". I must have had some sort of cached data that was preventing any form of control+drag. – TexanJohn Apr 09 '19 at 01:49