|
1 | 1 | # SlidableImage |
2 | | - |
3 | | -[]() |
| 2 | + |
| 3 | +[](https://github.com/quver/SlidableImage/actions/workflows/ci.yml) |
| 4 | +[](https://github.com/quver/SlidableImage/blob/main/LICENSE) |
4 | 5 | [](https://swift.org/package-manager) |
| 6 | +[](https://swiftpackageindex.com/quver/SlidableImage) |
| 7 | +[](https://swiftpackageindex.com/quver/SlidableImage) |
5 | 8 |
|
6 | | -Easy to use library for before & after images. One-line initialization and SwiftUI. |
| 9 | +SwiftUI before & after image slider with a draggable divider. |
7 | 10 |
|
8 | 11 | ## Requirements |
9 | 12 |
|
10 | | -- iOS 15 |
11 | | -- Swift 5 |
| 13 | +- iOS 15+ / macOS 12+ |
| 14 | +- Swift 6.1+ |
| 15 | +- Xcode 16.4+ |
12 | 16 |
|
13 | | -## Instalation |
| 17 | +## Installation |
14 | 18 |
|
15 | | -This library support |
| 19 | +### Swift Package Manager |
16 | 20 |
|
17 | | -- Swift Package Manager |
| 21 | +Add to your `Package.swift`: |
18 | 22 |
|
19 | | -## Using |
| 23 | +```swift |
| 24 | +dependencies: [ |
| 25 | + .package(url: "https://github.com/quver/SlidableImage.git", from: "5.0.0") |
| 26 | +] |
| 27 | +``` |
20 | 28 |
|
21 | | - |
| 29 | +Or add it directly in Xcode via **File → Add Package Dependencies**. |
22 | 30 |
|
23 | | -### Constructor |
| 31 | +## Usage |
24 | 32 |
|
25 | | -```swfit |
26 | | -init(@ViewBuilder arrows: @escaping () -> ArrowsIcon, |
27 | | - @ViewBuilder leftView: @escaping () -> LeftView, |
28 | | - @ViewBuilder rightView: @escaping () -> RightView) |
| 33 | +```swift |
| 34 | +SlidableImage( |
| 35 | + arrows: { Arrows() }, |
| 36 | + leftView: { Image("before") }, |
| 37 | + rightView: { Image("after") } |
| 38 | +) |
29 | 39 | ``` |
30 | 40 |
|
31 | | -### Arrows |
| 41 | +### Custom arrows |
32 | 42 |
|
33 | 43 | ```swift |
34 | | -init(arrowColor: Color = .white, backgroundColor: Color = .gray) |
| 44 | +SlidableImage( |
| 45 | + arrows: { |
| 46 | + Arrows(arrowColor: .black, backgroundColor: .white) |
| 47 | + }, |
| 48 | + leftView: { Image("before") }, |
| 49 | + rightView: { Image("after") } |
| 50 | +) |
35 | 51 | ``` |
36 | 52 |
|
37 | | -## Author |
| 53 | +### Custom divider |
38 | 54 |
|
39 | | -Paweł Bednorz, Quver |
| 55 | +Pass any SwiftUI view as the `arrows` parameter: |
| 56 | + |
| 57 | +```swift |
| 58 | +SlidableImage( |
| 59 | + arrows: { |
| 60 | + Image(systemName: "arrow.left.and.right") |
| 61 | + .padding() |
| 62 | + .background(.ultraThinMaterial, in: Circle()) |
| 63 | + }, |
| 64 | + leftView: { Image("before") }, |
| 65 | + rightView: { Image("after") } |
| 66 | +) |
| 67 | +``` |
40 | 68 |
|
41 | | -## License |
| 69 | +## Documentation |
42 | 70 |
|
43 | | -SlidableImage Lib and Slider graphic are available under the MIT license. |
44 | | -Check the LICENSE file for more information. |
| 71 | +Full API documentation is available at [quver.github.io/SlidableImage](https://quver.github.io/SlidableImage/documentation/slidableimage/). |
0 commit comments