I have an inner custom UITableViewCell
class (class inside a class), I would like to use it in Interface Builder. However, it can't recognize it there.
import UIKit
class ContactListViewController: UIViewController {
class Cell: UITableViewCell {
@IBOutlet weak var name: UILabel!
@IBOutlet weak var phone: UILabel!
}
@IBOutlet weak var tableView: UITableView!
}
The configuration of above image didn't work. Is there a way to do it?
You need to specify objective c name for your nested class with @objc
then use it in the Interface Builder:
import UIKit
class ContactListViewController: UIViewController {
@objc(CLCell) class Cell: UITableViewCell {
@IBOutlet weak var name: UILabel!
@IBOutlet weak var phone: UILabel!
}
@IBOutlet weak var tableView: UITableView!
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With