>
>
> 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
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution