Skip to content

Commit caf1f99

Browse files
authored
Update README with aspect ratio documentation
1 parent 3fac810 commit caf1f99

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,30 @@ struct ContentView: View {
8686
}
8787
```
8888

89+
### Explicit Aspect Ratio
90+
91+
#### Availability: 1.0.21 or higher
92+
93+
An explcit image aspect ratio can be specified, which fixes an issue of incorrect stretching that occurs in certain situations. The `aspectRatio` parameter accepts `Binding<CGFloat>`
94+
95+
Example:
96+
```Swift
97+
import ImageViewer
98+
99+
struct ContentView: View {
100+
@State var showImageViewer: Bool = true
101+
@State var image = Image("example-image")
102+
103+
var body: some View {
104+
VStack {
105+
Text("Example!")
106+
}
107+
.frame(maxWidth: .infinity, maxHeight: .infinity)
108+
.overlay(ImageViewer(image: self.$image, viewerShown: self.$showImageViewer, aspectRatio: .constant(2)))
109+
}
110+
}
111+
```
112+
89113
# Compatibility
90114

91115
This package is compatible on iOS 13 and later.

0 commit comments

Comments
 (0)