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.
- 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.
- iOS 12.0+
- Xcode 11+
- Swift 5.5+
You can integrate SwiftImageTransitionFX into your project manually or SPM
https://github.com/furkansandal/SwiftImageTransitionFX.git
- Download the
SwiftImageTransitionFX.swift
file. - Drag and drop it into your Xcode project.
- Ensure to check "Copy items if needed" and add it to your target.
- Import SwiftImageTransitionFX in your ViewController.
import SwiftImageTransitionFX
- Initialize
SwiftImageTransitionFXView
and add it to your view.
let imageTransitionView = SwiftImageTransitionFXView()
view.addSubview(imageTransitionView)
- Set the before and after images.
imageTransitionView.populate(beforeImage: UIImage(named: "beforeImage"), afterImage: UIImage(named: "afterImage"))
- Start the transition.
imageTransitionView.start()
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
Contributions are very welcome! If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
The code in this project is licensed under MIT license. See the LICENSE file for more information.