>
>
>         class UITableView {
>                 ...
>                 private func addRow(at indexPath: NSIndexPath) {
>                         ...
>                         cell.size.height = delegate?.tableView(self,
> heightForRowAtIndexPath: indexPath) ?? rowHeight
>                         ...
>                 }
>                 ...
>

You need not duplicate the default logic:


private class DefaultDelegate: NSObject, UITableViewDelegate { }
private let defaultDelegate = DefaultDelegate()

public class UITableView {

    private func addRow(at indexPath: NSIndexPath) {
        ...
        cell.size.height = (delegate ?? defaultDelegate).tableView(self,
heightForRowAtIndexPath: indexPath)
        ...
    }

}
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to