Skip to content

Commit 09743c9

Browse files
authored
Update README with caption parameter
1 parent dacc75d commit 09743c9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,31 @@ struct ContentView: View {
6565

6666
# Customization
6767

68+
69+
### Caption
70+
71+
#### Availability: 2.1.0 or higher
72+
73+
A caption can be added to the image viewer. The caption will appear near the bottom of the image viewer (if the image fills the whole screen the text will appear on top of the image). The `caption` parameter accepts `Text`.
74+
75+
Example:
76+
```Swift
77+
import ImageViewer
78+
79+
struct ContentView: View {
80+
@State var showImageViewer: Bool = true
81+
@State var image = Image("example-image")
82+
83+
var body: some View {
84+
VStack {
85+
Text("Example!")
86+
}
87+
.frame(maxWidth: .infinity, maxHeight: .infinity)
88+
.overlay(ImageViewer(image: self.$image, viewerShown: self.$showImageViewer, caption: Text("This is a caption!")))
89+
}
90+
}
91+
```
92+
6893
### Explicit Aspect Ratio
6994

7095
#### Availability: 1.0.21 or higher

0 commit comments

Comments
 (0)