Skip to content

Commit

Permalink
Add missing concrete delegate forward implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
toshi0383 committed Oct 22, 2021
1 parent 047f98b commit 9cf32ec
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion ReverseExtension/ReverseExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ extension UITableView.ReverseExtension: UITableViewDelegate {
cell.contentView.transform = CGAffineTransform.identity.rotated(by: .pi)
UIView.setAnimationsEnabled(true)
}

delegate?.tableView?(tableView, willDisplay: cell, forRowAt: reversedIndexPath(with: indexPath))
}

public func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
Expand All @@ -420,6 +422,8 @@ extension UITableView.ReverseExtension: UITableViewDelegate {
view.transform = CGAffineTransform.identity.rotated(by: .pi)
UIView.setAnimationsEnabled(true)
}

delegate?.tableView?(tableView, willDisplayHeaderView: view, forSection: reversedSection(with: section))
}

public func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection section: Int) {
Expand All @@ -428,6 +432,30 @@ extension UITableView.ReverseExtension: UITableViewDelegate {
view.transform = CGAffineTransform.identity.rotated(by: .pi)
UIView.setAnimationsEnabled(true)
}

delegate?.tableView?(tableView, willDisplayFooterView: view, forSection: reversedSection(with: section))
}

public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
delegate?.tableView?(tableView, heightForHeaderInSection: reversedSection(with: section)) ?? .leastNonzeroMagnitude
}

public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
delegate?.tableView?(tableView, heightForFooterInSection: reversedSection(with: section)) ?? .leastNonzeroMagnitude
}

public func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
delegate?.tableView?(tableView, editingStyleForRowAt: indexPath) ?? .delete
}

@available(iOS 11.0, *)
public func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
delegate?.tableView?(tableView, trailingSwipeActionsConfigurationForRowAt: indexPath)
}

@available(iOS 11.0, *)
public func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
delegate?.tableView?(tableView, leadingSwipeActionsConfigurationForRowAt: indexPath)
}
}

Expand Down Expand Up @@ -456,7 +484,19 @@ extension UITableView.ReverseExtension: UITableViewDataSource {
public func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
return dataSource?.tableView?(tableView, titleForHeaderInSection: reversedSection(with: section))
}


public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return delegate?.tableView?(tableView, viewForHeaderInSection: reversedSection(with: section))
}

public func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return delegate?.tableView?(tableView, viewForFooterInSection: reversedSection(with: section))
}

public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
delegate?.tableView?(tableView, didSelectRowAt: reversedIndexPath(with: indexPath))
}

// Editing

// Individual rows can opt out of having the -editing property set for them. If not implemented, all rows are assumed to be editable.
Expand Down

0 comments on commit 9cf32ec

Please sign in to comment.