Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
c-villain authored Dec 20, 2022
1 parent fa826f3 commit 2e62fe4
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ targets:
Basically there are two ways to mark your view as `Refreshable`.

<details>
<summary>The easiest one is to add modifier `refreshable` to your view.</summary>
<summary>The easiest one is to add modifier refreshable to your view.</summary>

```swift
import Refreshable
Expand All @@ -84,7 +84,7 @@ struct YourView: View {
</details>

<details>
<summary>Second one is to add manually `RefreshControl` to your view implementation.
<summary>Second one is to add manually RefreshControl to your view implementation.
Don't forget to name your view’s coordinate space!</summary>


Expand All @@ -110,6 +110,37 @@ struct YourView: View {

</details>

<details>
<summary>To control responsiveness for refreshable during scrolling use ScrollDistance. Or use defaults 😊.</summary>


```swift
import Refreshable
struct Constants {
public static let isPad: Bool = UIDevice.current.userInterfaceIdiom == .pad
}
struct YourView: View {
var body: some View {
ScrollView {
RefreshControl(Constants.isPad ? .long : .short, // <= HERE
coordinateSpace: .named("List")) {
// do your work on refresh here
}
LazyVStack {
...
}
}
.coordinateSpace(name: "List")
}
}
```

</details>

## Communication

- If you **found a bug**, open an issue or submit a fix via a pull request.
Expand Down

0 comments on commit 2e62fe4

Please sign in to comment.