Skip to content

Commit

Permalink
[ADD] Added scrolledToEndPublisher. This sends event when the list …
Browse files Browse the repository at this point in the history
…is scrolled to the end
  • Loading branch information
Jaesung Lee committed Aug 1, 2023
1 parent d54567a commit ab5b2a8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Sources/ChatUI/Publishers/ScrolledToEndPublisher.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// ScrolledToEndPublisher.swift
//
//
// Created by Jaesung Lee on 2023/03/19.
//

import Combine

// TODO: Unstable

/**
The publisher that sends event when the list is scrolled to the end.
```swift
// How to publish
scrolledToEndPublisher.send(true)
```
```swift
// How to subscribe
.onReceive(scrolledToEndPublisher) { isEnded in
if isEnded {
loadMoreMessages()
}
}
```
- Important: This publisher is the beta feature.
*/
public var scrolledToEndPublisher = PassthroughSubject<Bool, Never>()

0 comments on commit ab5b2a8

Please sign in to comment.