Swift - How to inherit from a custom cell that's tied to a xib file
<p>I have a custom cell called <em>NormalImageCell</em> that inherits from <em>UITableViewCell</em> and is tied to a xib. Let's say I wanted to create a new cell called <em>LargeImageCell</em> that inherits from <em>NormalImageCell</em> without creating a whole new xib. I can do this easily programmatically without interface builder, but due to <em>NormalImageCell</em> being tied to a xib and the cell in the xib can only be connected to one custom class and one reuseIdentifier, how would I be able to reuse it for LargeImageCell?</p>

<p>This works without Interface Builder.</p>

<p><code>class LargeImageCell: NormalImageCell {...}</code></p>

<pre><code>tableView.registerClass(NormalImageCell.self, forCellWithReuseIdentifier: NormalImageCell.id())
tableView.registerClass(LargeImageCell.self, forCellWithReuseIdentifier: LargeImageCell.id())
</code></pre>

<p>This crashes with Interface Builder:</p>

<pre><code>tableView.registerNib(NormalImageCell.nib(), forCellWithReuseIdentifier: NormalImageCell.id())
tableView.registerNib(LargeImageCell.nib(), forCellWithReuseIdentifier: LargeImageCell.id())
</code></pre>

<p>BTW, I'm declaring the nib and id methods like this:</p>

<pre><code>class NormalImageCell: UITableViewCell {

    class func id() -&gt; String {
        return String(self)
    }

    class func nib() -&gt; UINib { 
        return UINib(nibName: String(self), bundle: nil) 
    }
}

class LargeImageCell: NormalmageCell {
    ...
}
</code></pre>