class FLAnimatedImageViewįLAnimatedImageView automatically plays the GIF in the view hierarchy and stops when it’s removed. imageView.animatedImageįLAnimatedImageView is a subclass of UIImageView and takes a FLAnimatedImage. FLAnimatedImage has an initializer that accepts this Data: convenience init(animatedGIFData data: Data!)Īfter creating an instance of an image of the type FLAnimatedImage, we can use it to set the image property of FLAnimatedImageView. To load a GIF image, we convert the GIF into a Data value type. We use it to set the image property of the FLAnimatedImageView class. We want to use FLAnimatedImage with the SwiftUI framework, but before doing so, we should understand this library’s two main classes:įLAnimatedImage is a class that helps deliver the frames in a performant way. The example in the GitHub repo for FLAnimatedImage is written in Objective-C: #import "FLAnimatedImage.h"įLAnimatedImage *image = init] Click continue, and you’ve added FLAnimatedImage to the project! Using FLAnimatedImage with Objective-C Then, click on Next and select the project target to which the library should be added. Next, paste the following link in the project URL field: To use Swift Package Manager to add FLAnimatedImage to a project, open Xcode, go to the menu bar, and select File > Add Packages. Then, to update only this library, go to your terminal’s project directory and run the following command: carthage update FLAnimatedImage To add FLAnimatedImage to a project using Carthage, add the following code in the Cartfile: github "Flipboard/FLAnimatedImage" Then, go to your terminal’s project directory and install the pod, like so: pod install To add FLAnimatedImage to a project using CocoaPods, add the following code to the Podfile: pod 'FLAnimatedImage'
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |