<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
        class UITableView {<br>
                ...<br>
                private func addRow(at indexPath: NSIndexPath) {<br>
                        ...<br>
                        cell.size.height = delegate?.tableView(self, heightForRowAtIndexPath: indexPath) ?? rowHeight<br>
                        ...<br>
                }<br>
                ...<br></blockquote><div><br></div><div>You need not duplicate the default logic:</div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>private class DefaultDelegate: NSObject, UITableViewDelegate { }</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>private let defaultDelegate = DefaultDelegate()</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>public class UITableView {</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    private func addRow(at indexPath: NSIndexPath) {</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>        ...</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>        cell.size.height = (delegate ?? defaultDelegate).tableView(self, heightForRowAtIndexPath: indexPath)</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>        ...</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    }</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>}</div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div></div>