Here is the inheritance tree of my table view cells.
+----------------+ | UITableViewCel | +-------+--------+ ^ | +-------+--------+ | BaseFormCell | +-------+--------+ ^ | +--------+---------+ | TypedFormCell<T> | +--------+---------+ ^ | +--------+----------+ | TextFieldFormCell | : TypedFormCell<String> +-------------------+ where TextFieldFormCell has an associated xib file which is used to instantiate itself.
When I call Bundle.main.loadNibNamed("TextFieldFormCell", owner: nil, options: nil), an exception is thrown and says
[< UITableViewCell 0x7fe89584fa00 > setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key nameLabel.
I noticed that the xib didn't instantiate a TextFieldFormCell for me. Instead, it created a UITableViewCell and tried to inject the nameLabel to UITableViewCell, which caused the exception.
Does this mean that IB doesn't support generic classes or classes inherit from generic classes?
Here is the GitHub repo of this demo. https://github.com/hikui/TypedCellDemo