In an extranal library that I pull in via a pod I've got this class defined.
open class ExpandableDatePickerCell : UITableViewCell {
public static func reusableCell(for indexPath: IndexPath, in tableView: UITableView) -> ExpandableDatePickerCell {
return tableView.dequeueReusableCell(withIdentifier: ExpandableDatePickerCell.identifier, for: indexPath) as! ExpandableDatePickerCell
}
}
Obviously there's some other stuff, that's the interesting method. Then in my project I inherit from that cell.
final class UserProfileDatePickerCell : ExpandableDatePickerCell {
When I hit tableView(_:cellForRowAt:) I'm trying to now get one of those cells, but it's crashing. I call it like so:
let cell = UserProfileDatePickerCell.reusableCell(for: indexPath, in: tableView) as! UserProfileDatePickerCell
But it's getting a SIGABRT with the message:
Could not cast value of type 'ExpandableDatePicker.ExpandableDatePickerCell' (0x103ed3e60) to 'TeamKnect.UserProfileDatePickerCell' (0x103807c78).
I don't understand why it can't do the cast since it's a child.