/SwiftImageTransitionFX

A customizable UI component for smooth before-and-after image transition effects.

Primary LanguageSwiftMIT LicenseMIT

SwiftImageTransitionFX

SwiftImageTransitionFX is a Swift-based library designed for iOS, enabling developers to easily add captivating before-and-after image transitions to their applications. With customizable transition effects, you can enhance the visual experience in your app.

Features

  • Customizable Transitions: Easily adjust the color, width, and speed of the image transition effect.
  • Looping Animations: Option to loop the transition effect infinitely or for a set number of times.
  • Auto Reverse: Automatically return to the before image after showing the after image, with customizable speeds.

Requirements

  • iOS 12.0+
  • Xcode 11+
  • Swift 5.5+

Installation

You can integrate SwiftImageTransitionFX into your project manually or SPM

SPM Link

https://github.com/furkansandal/SwiftImageTransitionFX.git

Manual Installation

  1. Download the SwiftImageTransitionFX.swift file.
  2. Drag and drop it into your Xcode project.
  3. Ensure to check "Copy items if needed" and add it to your target.

Usage

Basic Setup

  1. Import SwiftImageTransitionFX in your ViewController.
import SwiftImageTransitionFX
  1. Initialize SwiftImageTransitionFXView and add it to your view.
let imageTransitionView = SwiftImageTransitionFXView()
view.addSubview(imageTransitionView)
  1. Set the before and after images.
imageTransitionView.populate(beforeImage: UIImage(named: "beforeImage"), afterImage: UIImage(named: "afterImage"))
  1. Start the transition.
imageTransitionView.start()

Customization

Customize the transition by adjusting the properties of your SwiftImageTransitionFXView instance.

imageTransitionView.transitionColor = .red
imageTransitionView.transitionWidth = 10.0
imageTransitionView.forwardSpeed = 5.0
imageTransitionView.backwardSpeed = 5.0
imageTransitionView.isInfinityLoop = false

Contribution

Contributions are very welcome! If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.

Licensing

The code in this project is licensed under MIT license. See the LICENSE file for more information.