heythem500
heythem500

Reputation: 143

Failed to execute method-- error:Value of type 'UITableViewCell' has no member 'getCell'

I'm trying to call a func in cell method but before that I need to call the func in View controller cell. Every time I try to call Xcode doesn't recognize it and an error appears. If I just copy it (Value of type 'UITableViewCell' has no member 'getCell').

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell:TableViewCell1 = tableViewFullP1.dequeueReusableCell(withIdentifier: "cell01", for: indexPath) as! TableViewCell1

    configureCell(cell, at: indexPath) // The one I want to call in the end

    return cell
}

//Fetch Method P1
func fetchInfoToHomepage() {
    let fetchRequest88: NSFetchRequest<Information> = Information.fetchRequest()
    let sortOnDate = NSSortDescriptor(key: "date_info9", ascending: false)

    fetchRequest88.sortDescriptors = [sortOnDate]

    controllerItch = NSFetchedResultsController(fetchRequest: fetchRequest88, managedObjectContext: context77, sectionNameKeyPath: nil, cacheName: nil)
    controllerItch.delegate = self

    do {
        try controllerItch.performFetch()
    } catch {print("Failed fetch p1")}
}

// Sepcical func
func configureCell(_ cell: UITableViewCell, at indexPath: IndexPath) {
    var malekHosny = controllerItch.object(at: indexPath)
    cell.getCell(infos: malekHosny) //Here's the problem
}

Upvotes: 1

Views: 157

Answers (1)

matt
matt

Reputation: 536027

Presumably your UITableViewCell subclass does have a getCell method. So you need to cast to that subclass:

(cell as! TableViewCell1).getCell...

Upvotes: 1

Related Questions