Could not insert new outlet connection: Could not find any information for the class named

Solution 1:

Here are some things that can fix this (in increasing order of difficulty):

  • Clean the project (Product > Clean)
  • Manually paste in

    @IBOutlet weak var viewName: UIView!
    // or
    @IBAction func viewTapped(_ sender: Any) { }
    

    and control drag to it. (Change type as needed.) Also see this.

  • Completely close Xcode and restart your project.

  • Delete the Derived Data folder (Go to Xcode > Preferences > Locations and click the gray arrow by the Derived Data folder. Then delete your project folder.)
  • Click delete on the class, remove reference (not Move to Trash), and add it back again. (see this answer)

Solution 2:

Or if none of the above works, type out the name of the outlet into the file first @IBOutlet weak var headerHeightConstraint: NSLayoutConstraint! and then click and drag from the outlet in the nib to the variable you just programmatically created. It should work without any of the hassle of cleaning, building, and deleting anything.

Solution 3:

Just perform the two following steps to get rid of this error

  1. Clean project using Product > clean
  2. Run the project

Now try to add the action or outlet. That's it.

Happy Coding

Solution 4:

None of the tips in the best answer worked for me. Was going crazy. Then noticed that the Assistant Editor had somehow gotten set to Manual and I was on the ViewController.swift (Interface) instead of the ViewController.swift file.

Changed that and problem solved. A bit embarrassing but hey, we are all learning.

enter image description here

Solution 5:

Here are the steps solved for me:

  1. Remove Class name reference from View(storyboard/xib) and save;
  2. Add Class name again and save;
  3. Clean and Build;

Done !