-
-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
As of now, we need some specific delegate methods to make PullToDismiss work. If we want to use delegate methods other than the specific ones, we have no choice but to implement them as a method in PullToDismiss's subclass.
You know, that is not cool. 😢
class CustomPullToDismiss: PullToDismiss {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return tableViewDelegate?.tableView?(tableView, heightForRowAt: indexPath) ?? 44.0
}
}
class SampleViewController: UIViewController {
@IBOutlet private weak var tableView: UITableView!
private var pullToDismiss: PullToDismiss?
override func viewDidLoad() {
super.viewDidLoad()
pullToDismiss = CustomPullToDismiss(scrollView: tableView)
pullToDismiss.delegateProxy = self
}
}
extension SampleViewController: UITableViewDelegate {
// called by CustomPullToDismiss
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return indexPath.section == 0 ? 44.0 : 60.0
}
// ...
}
That is why I decided to restructure the design of delegate proxy so that implementing more delegate methods into the subclass will be no longer needed.
Metadata
Metadata
Assignees
Labels
No labels