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 Jan 27, 2023
1 parent 6dc1a4c commit adec1bf
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,42 @@ in ```.addSwipeAction { ... }``` add ```Rectangle``` filled with *same* color as

</details>

<details>
<summary>With context menu.</summary>

<p align="center">
<img src="Sources/Gifs/withContextMenuDemo.gif" alt="Demo without insets" width="280">
</p>

Due to some difficulties for SwiftUI to detect gestures for sliding view and opening context menu I recommend you to use
`.contextMenu` after `.addSwipeAction` (or `addFullSwipeAction`):

```swift
YourView()
.frame(height: 80)
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
.padding()
.background(Color(UIColor.systemBackground))
.addFullSwipeAction(...) { ... } // <=== Look here!
.contextMenu { ... }
```

Actually if you don't use `.contentShape(Rectangle())`, you can also add `.contextMenu` before `.addSwipeAction` (or `addFullSwipeAction`):

```swift
YourView()
.frame(height: 80)
.frame(maxWidth: .infinity)
//.contentShape(Rectangle()) // <=== Look here!
.padding()
.contextMenu { ... } // <=== Look here!
.background(Color(UIColor.systemBackground))
.addFullSwipeAction(...) { ... } // <=== Look here!
```

</details>

## Communication

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

0 comments on commit adec1bf

Please sign in to comment.