Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,33 +634,37 @@ Example:

```swift
class ViewController: ScrollStackController, ScrollStackControllerDelegate {

func viewDidLoad() {
super.viewDidLoad()

self.scrollStack.stackDelegate = self
}

func scrollStackDidScroll(_ stackView: ScrollStack, offset: CGPoint) {
// stack did scroll
}

func scrollStackRowDidBecomeVisible(_ stackView: ScrollStack, row: ScrollStackRow, index: Int, state: ScrollStack.RowVisibility) {
// Row did become partially or entirely visible.
}

func viewDidLoad() {
super.viewDidLoad()

self.scrollStack.stackDelegate = self
}

func scrollStackDidScroll(_ stackView: ScrollStack, offset: CGPoint) {
// Stack did scroll
}

func scrollStackRowDidBecomeHidden(_ stackView: ScrollStack, row: ScrollStackRow, index: Int, state: ScrollStack.RowVisibility) {
// Row did become partially or entirely invisible.
}

func scrollStackDidEndScrollingAnimation(_ stackView: ScrollStack) {
// Scrolling animation has ended
}

func scrollStackDidUpdateLayout(_ stackView: ScrollStack) {
// This function is called when layout is updated (added, removed, hide or show one or more rows).
}
func scrollStackRowDidBecomeVisible(_ stackView: ScrollStack, row: ScrollStackRow, index: Int, state: ScrollStack.RowVisibility) {
// Row did become partially or entirely visible.
}

func scrollStackContentSizeDidChange(_ stackView: ScrollStack, from oldValue: CGSize, to newValue: CGSize) {
// This function is called when content size of the stack did change (remove/add, hide/show rows).
}
func scrollStackRowDidBecomeHidden(_ stackView: ScrollStack, row: ScrollStackRow, index: Int, state: ScrollStack.RowVisibility) {
// Row did become partially or entirely invisible.
}

func scrollStackDidUpdateLayout(_ stackView: ScrollStack) {
// This function is called when layout is updated (added, removed, hide or show one or more rows).
}

func scrollStackContentSizeDidChange(_ stackView: ScrollStack, from oldValue: CGSize, to newValue: CGSize) {
// This function is called when content size of the stack did change (remove/add, hide/show rows).
}
}
```

Expand Down
8 changes: 8 additions & 0 deletions Sources/ScrollStackController/ScrollStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,14 @@ open class ScrollStack: UIScrollView, UIScrollViewDelegate {
dispatchRowsVisibilityChangesTo(stackDelegate)
}

public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
guard let stackDelegate = stackDelegate else {
return
}

stackDelegate.scrollStackDidEndScrollingAnimation(self)
}

open override func layoutSubviews() {
super.layoutSubviews()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public protocol ScrollStackControllerDelegate: AnyObject {
/// - Parameter offset: current scroll offset.
func scrollStackDidScroll(_ stackView: ScrollStack, offset: CGPoint)

/// Tells the delegate when a scrolling animation in the scroll view concludes.
///
/// - Parameter stackView: The ScrollStack object that’s performing the scrolling animation.
func scrollStackDidEndScrollingAnimation(_ stackView: ScrollStack)

/// Row did become partially or entirely visible.
///
/// - Parameter row: target row.
Expand Down