Error Type 'PhotoCarouselTableViewCell' has no member 'identifier'

Running into an error. What am I doing wrong? This is my second project with the same issue. PLEASE HELP!

import UIKit

struct TextCellViewModel {

  let text: String   let font: UIFont

}

enum SectionType {

  case productPhotos(images: [UIImage])   case productInfo(viewModels: [TextCellViewModel])   case relatedProducts(viewModels: [RelatedProductTableViewCellViewModel])

      var title: String? {

    switch

self {

    case .relatedProducts:       return "Related Products"     default:       return nil

    }   } }

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {       private let tableView: UITableView = {

    let table = UITableView()     table.register(UITableViewCell.self, forCellReuseIdentifier: "cell")     table.register(PhotoCarouselTableViewCell.self, forCellReuseIdentifier: PhotoCarouselTableViewCell.identifier)     table.register(RelatedProductTableViewCell.self, forCellReuseIdentifier: RelatedProductTableViewCell.identifier)                return table   }()

Please edit your code with code formatter tool (<>) when you paste it. Otherwise it is just unreadable

import UIKit
struct TextCellViewModel {
    let text: String
    let font: UIFont
}

enum SectionType {
    case productPhotos(images: [UIImage])
    case productInfo(viewModels: [TextCellViewModel])
    case relatedProducts(viewModels: [RelatedProductTableViewCellViewModel])
    var title: String? {
        switch
        self {
            case .relatedProducts:  return "Related Products"
            default: return nil
        }
    }
}

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
    
    private let tableView: UITableView = {
        let table = UITableView()
        table.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
        table.register(PhotoCarouselTableViewCell.self, forCellReuseIdentifier: PhotoCarouselTableViewCell.identifier)
        table.register(RelatedProductTableViewCell.self, forCellReuseIdentifier: RelatedProductTableViewCell.identifier)
        return table
    }()

You do not show how you defined PhotoCarouselTableViewCell, but it is likeky a subclass of UITableViewCell.

It is not identifier, but reuseIdentifier

And you should call it on an instance of cell. In addition, it is an optional, must be unwrapped.

So call:

tableregister(PhotoCarouselTableViewCell.self, forCellReuseIdentifier: PhotoCarouselTableViewCell().reuseIdentifier ?? "")

Note: why not pass directly the identifier ?

I found my error it was a simple misspelling! Thank you all

Error Type 'PhotoCarouselTableViewCell' has no member 'identifier'
 
 
Q