Skip to content

Commit

Permalink
Merge pull request #34 from jaesung-0o0/feature/jaesung/scrolled-to-e…
Browse files Browse the repository at this point in the history
…nd-publisher

Added `scrolledToEndPublisher` (Beta)
  • Loading branch information
x-0o0 authored Aug 1, 2023
2 parents 8298be6 + ab5b2a8 commit 10d6461
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 10d6461

Please sign in to comment.