Skip to content

Commit 795c59c

Browse files
authored
Merge pull request #21 from khurshedgulov/DecoratableTableView
DecoratableTableView - introduced protocol which can be used for applying any kind of decorations for UITableView cells
2 parents ed7acbe + 77ebf47 commit 795c59c

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// DecoratableTableView.swift
3+
//
4+
//
5+
// Created by Khurshed Gulov on 11/01/24.
6+
//
7+
8+
import Foundation
9+
import UIKit
10+
11+
public protocol DecoratableTableView where Self: UITableView {
12+
func applyDecoration(for indexPath: IndexPath)
13+
}

Sources/DataDrivenRxDatasources/TableView/RxTableView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ private final class TableViewControllerDelegateProxy<DataSource: ExtendedSection
261261
return false
262262
}
263263

264+
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
265+
guard let tableView = tableView as? DecoratableTableView else { return }
266+
tableView.applyDecoration(for: indexPath)
267+
}
268+
264269
private func _sectionHeaderModel(at index: Int) -> HeaderFooterViewModel? {
265270
return _dataSource.sectionModel(at: index)
266271
.flatMap { $0 as? SectionHeaderViewType }

0 commit comments

Comments
 (0)