Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryu0118 authored Oct 26, 2023
1 parent 8b6ef43 commit 9e5db74
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,29 @@ You can also customize the background view that appears behind the popup. By def
}
```

### Item-based Presentation
With item-based presentation, you can display a popup based on an object that conforms to the Identifiable and Equatable protocols. This is particularly useful when you have a list of items and you want to present a popup for a specific item when it is selected.

Here’s how you can use it:

```Swift
public struct ContentView: View {
@State private var selectedItem: Item? = nil
public var body: some View {
List(items) { item in
Text(item.name)
.onTapGesture {
selectedItem = item
}
}
.popup(item: $selectedItem) { item in
// Your custom popup content based on the selected item
}
}
}
```


## Installation
```Swift
let package = Package(
Expand Down

0 comments on commit 9e5db74

Please sign in to comment.