Could not insert new outlet connection: Could not find any information for the class named
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)
Could not insert new outlet connection error
So, it turns out that I was being a fool. You can't quite do it like this with Xcode. If you create the properties manually in the header file, then synthesise them in the class file, you can then link by doing the following:
Open the xib file
Right click on the cell in the "Objects" panel
Click and drag from the options here to the objects on the xib.
That's all there was to it.
Cannot add Outlet connection from Button to ViewController
I see the you have multiple ViewControllers in storyboard. Ideally, each View controller in the storyboard is supposed to be of only one type of UIViewController implementation and it's also true the other way around. so, If you have say 3 UIViewControllers in Your storyBoard, then you will need to create 3 .swift
files which implement UIViewController like so:
abcVC:UIViewController { .....
efgVC:UIViewController { .....
ViewController:UIViewController { ..... //this is the default one you get.
and then set the class of each ViewController in your storyboard to one of each of the above.
if your ViewController which has the button you want to outlet has a class type abcVC, then you can outlet your button only in abcVc
's implementation in abcVC.swift
.
Hope it makes sense. to see how to set class, refer @Vadim F. 's answer.
and if you happen to upvote this answer, please also consider upvoting @Vadim F. 's answer.
This is how you can crate a new .swift
file while subclassing a UIViewController: File -> new -> File -> Cocoa touch class -> #make it subclass of UIViewController and give it a unique name eg: abcVC
Related Topics
How to Tap on a Specific Point Using Xcode Uitests
Dismissing Both Uinavigation Views and Modal Views at Once Programmatically
Aes/Cbc/Pkcs5Padding in iOS Objective C Result Differs from Android
How Programmatically Restart an iPhone App in iOS
Convert an Nsurl to an Nsstring
Canopenurl - This App Is Not Allowed to Query for Scheme Instragram
Local and Push Notifications in iOS Version Compatible
Fbsdkloginmanager Loginwithpublishpermissions Always Returns Iscancelled=Yes
How to Get Word Wrap Information with the New iOS 7 APIs
Parse Multipart Response for Image Download in iOS
Set Custom Images to the Uibarbuttonitem But It Doesn't Show Any Image
Aligning Right to Left on Uicollectionview