Im getting following error when I'm trying to connect outlet from my search bar.
How can I solve that?
Im getting following error when I'm trying to connect outlet from my search bar.
How can I solve that?
I had this issue and I searched for several days how to fix this. I tried every solution that I could find, but without any luck.
I started looking in my git history on which branch the error occurred. I found a solution after several days.
I was working on a big project and I wanted to speed up my build speed and I changed some stuff in the build settings. The build setting that caused this issue was 'Swift compiler - Optimization level'. I changed the default value (No optimization) to 'Optimize for speed' and this caused the issue "Could not insert new outlet connection".
I hope I can help others with this solution because I lost a lot of time with it.
In my case nothing worked
1) Deleting Class
2) Disconnecting the @IBOutlet
3) Manually Creating @IBOutlet Connections
The thing which did work was to restart XCode
After restart you can easily connect them without errors
Check that ViewController is correct or not?
Or
Clear class name in storyboard and edit again and also in class file
Or
quit Xcode and reopen and try that
Can you connect the other way, ie from the IBOutlet to the search bar ? In such a case, a clean of build border plus a reopen of the project should solve the problem.
I know it's too late to answer this question. But, I think it was because you made a change to the class name on your swift file and it hasn't been saved yet. (The file is grayed out)
My solution: Try building it (Command + B), then connect it again.
I created two classes with the same name in the project which gave me this error. By deleting one class file the issue got resolved.
What worked for me was to make the call the other way around, example: @IBOutlet weak var imageView: UIImageView!
I connected the .swift file to the .storyboard
Error? Just check the locations of UI class file(swift) and UI builder file(xib or storyboard). Best is "Relative to Group"