Reputation: 25701
I have a table view cell create like this where the code crashes on:
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier") as! TestedViewCell;
cell.delegate = self;
I have the code to create the subclass like so:
class TestedViewCell: SwipeTableViewCell
{
var animator: Any?
}
The above lines are in the same file with the kit imported. I then get the error like so:
Could not cast value of type 'SwipeCellKit.SwipeTableViewCell' (0x100121a60) to 'app.TestedViewCell' (0x100076f40).
Did I subclass it wrong? Thanks.
Upvotes: 0
Views: 122
Reputation: 2751
From your error
Could not cast value of type 'SwipeCellKit.SwipeTableViewCell' (0x100121a60) to 'app.TestedViewCell' (0x100076f40).
it is clear that your are trying to Cast SwipeTableViewcell as TestedViewCell. TestedViewCell is subclass of your SwipeTableViewcell . Issue might be in your register cell. You need to register cell in viewDidLoad as
self.tableView.registerClass(TestedViewCell.self, forCellReuseIdentifier: "testedViewCell")
Upvotes: 1
Reputation: 8322
Try to register TestedViewCell
in ViewDidLaod
self.tableView.registerClass(TestedViewCell.self, forCellReuseIdentifier: "reuseIdentifier")
Upvotes: 1