Introduction
Welcome to the documentation page for NSGIF!
Installation
To install NSGIF, you can use CocoaPods, a dependency manager for Swift and Objective-C projects. Simply add the following line to your Podfile:
pod 'NSGIF'
Then, run the command pod install
in your project directory.
Usage
Creating a GIF from Images
To create a GIF from a sequence of images, follow these steps:
- Import the NSGIF module into your file:
- Initialize an array of UIImages:
- Create a GIF from the image array:
import NSGIF
let imageArray = [UIImage(named: "image1"), UIImage(named: "image2"), UIImage(named: "image3")]
let gifData = NSGIF.createGIF(withImages: imageArray)
Creating an Animated GIF from Video
If you want to create an animated GIF from a video, follow these steps:
- Import the NSGIF module into your file:
- Initialize a video URL:
- Create an animated GIF from the video:
import NSGIF
let videoURL = URL(string: "yourVideoURL")
let gifData = NSGIF.createGIF(withVideo: videoURL)
Saving and Sharing GIFs
Once you have the GIF data, you can save or share it as needed. Here is an example of how to save a GIF to the device’s photo album:
UIImageWriteToSavedPhotosAlbum(gifData, nil, nil, nil)
Conclusion
NSGIF is a powerful library for creating GIFs from images and videos. With its easy-to-use functions, you can quickly generate animated content with just a few lines of code. We hope this documentation has provided you with all the information you need to get started with NSGIF.