Skip to content

Commit

Permalink
Add open method that is being called every time sections are updated
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-leitgeb committed Apr 23, 2020
1 parent 7524c40 commit d833b43
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Sources/DataSource/DataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ open class DataSource: NSObject {

public var sections: [Section] = [] {
didSet {
canCallScrollToBottom = true
sectionsDidUpdate(sections)
}
}

Expand All @@ -25,8 +25,16 @@ open class DataSource: NSObject {
self.sections = sections
}

// MARK: - Scroll view delegate
// MARK: - Utilities

open func sectionsDidUpdate(_ sections: [Section]) {
canCallScrollToBottom = true
}
}

// MARK: - UIScrollViewDelegate

extension DataSource {
open func scrollViewDidScroll(_ scrollView: UIScrollView) {
let offsetY = scrollView.contentOffset.y
let contentHeight = scrollView.contentSize.height
Expand Down

0 comments on commit d833b43

Please sign in to comment.