Solution :
Please find below the steps that can fix your issue:
· Clean your affected Project by doing Product > Clean
· Please Manually paste following code
· @IBOutlet weak var viewName: UIView!
// or
@IBAction func viewTapped(_ sender: Any) { }
control drag to it also change type as needed.
· Completely close your Xcode and restart your project.
· To Delete the Derived Data folder please Go to Xcode > Preferences > Locations and click the visible gray arrow by the Derived Data and after that delete your project folder.
· Finally click delete on the class and remove reference Please do not Move it to Trash and add it back again.
· This will solve your issue.
OR
Here are the alternate steps which solved the issue for me:
1. Please Remove Class name reference from View(e.g. storyboard/xib) and click on save;
2. After that Add Class name again and click on save;
3. Finally just do Clean and Build;
Done ! this will solve your issue.