/ImageSlider

A SwiftUI ImageSlider to compare two images

Primary LanguageSwift

ImageSlider

Swift package to easily add an ImageSlider to compare two images in your SwiftUI projects

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-08-04.at.15.26.12.1080p.mov

Usage

import ImageSlider

struct ContentView: View {

    let lhs: UIImage = 'PATH TO YOUR UIIMAGE'
    let rhs: UIImage = 'PATH TO YOUR UIIMAGE'

    var body: some View {
        GeometryReader { geometryProxy in
          ImageSlider(lhs: lhs, rhs: rhs)
            .frame(width: geometryProxy.size.width, height: geometryProxy.size.width)
        }
    }
}

Required parameters - init

  • lhs - The left hand UIImage to compare
  • rhs - The right hand UIImage to compare

Requirements

  • iOS 17.0+

Installation

dependencies: [
    .package(url: "https://github.com/fontno/ImageSlider.git")
]

Hire Me

I am available to work on Swift projects.

Contact me on github to talk.