## SwiftGifOrigin
### Overview
SwiftGifOrigin is a lightweight and easy-to-use library for displaying and managing GIF animations in Swift. It provides a simple interface to load GIF files from local or remote sources and easily display them in UIImageViews. Additionally, it supports pausing, resuming, and looping GIF animations.
### Installation
This library can be easily installed in your project using Swift Package Manager or Cocoapods.
#### Swift Package Manager
“`swift
// Add this dependency in your Package.swift file:
dependencies: [
.package(url: “https://github.com/swiftgiforigin/SwiftGifOrigin.git”, from: “1.0.0”)
]
“`
#### Cocoapods
“`ruby
# Add this line to your Podfile
pod ‘SwiftGifOrigin’
“`
### Usage
#### Import
“`swift
import SwiftGifOrigin
“`
#### Loading a GIF
To load a GIF and display it in a UIImageView, you can use the `UIImage.gifImageWithName(_:)` method. This method returns a UIImage object that can be assigned to the UIImageView’s image property.
“`swift
// Example usage
if let gifImage = UIImage.gifImageWithName(“example.gif”) {
imageView.image = gifImage
}
“`
#### Pausing, Resuming, and Looping
You can easily pause and resume a GIF animation using the `UIImageView.isAnimating` property. Setting it to `true` will resume the animation, while setting it to `false` will pause it.
“`swift
// Example usage
imageView.isAnimating = false // Pauses the GIF animation
imageView.isAnimating = true // Resumes the GIF animation
“`
To enable or disable looping for the GIF animation, you can use the `UIImageView.animationRepeatCount` property.
“`swift
// Example usage
imageView.animationRepeatCount = 0 // Loops indefinitely
imageView.animationRepeatCount = 3 // Loops three times
imageView.animationRepeatCount = 1 // Plays the animation once
“`
Please note that the loop count should be set before starting the animation.
#### Additional Methods
SwiftGifOrigin also provides some additional methods for more advanced usage, such as loading GIFs from URLs, NSData, or Data objects. Please refer to the [library documentation](https://github.com/swiftgiforigin/SwiftGifOrigin) for detailed information and examples on using these methods.
### Requirements
– iOS 10.0+
– Xcode 11+
– Swift 5.0+
### License
SwiftGifOrigin is available under the MIT license. See the [LICENSE](https://github.com/swiftgiforigin/SwiftGifOrigin/blob/master/LICENSE) file for more information.