TwitterGifComposer 0.1.1

TwitterGifComposer 0.1.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2015
SPMSupports SPM

Maintained by Zhenghong Wang.




TwitterGifComposer

Usage

Native iOS twitter composer does NOT support gif. This composer will help if you need to post gifs.

Although this project does NOT rely on FLAnimatedImage, but it can do better with it.

    class ViewController: UIViewController, TwitterGifComposerDelegate {

    /* ... */

    @IBAction func touchUpInside(sender: AnyObject) {

        var path = NSBundle.mainBundle().pathForResource("abc", ofType: "gif")
        var data = NSData(contentsOfFile: path!)
        self.twitterGifComposer = TwitterGifComposer.defaultComposer(delegate: self, rootViewController: self).withText("Post Gif").withGifData(data!)

        /*
            The image view in composer only show static image, by default.
            But if FLAnimatedImage is also imported, you can replace it as FLAnimatedImageView
        */
        var animatedImageView = FLAnimatedImageView(frame: CGRectZero)
        animatedImageView.animatedImage = FLAnimatedImage(GIFData: data!)
        animatedImageView.startAnimating()
        self.twitterGifComposer!.attachFLAnimatedImageView(animatedImageView)

        /* show the composer */
        self.twitterGifComposer!.show()

    }

    func onPostFailed() { }

    func onPostSuccessed() { }

    func onStopPost() { }

alt tag

Requirements

iOS 8.0

Installation

TwitterGifComposer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TwitterGifComposer"

Installation

Author

zh-wang, [email protected]

License

TwitterGifComposer is available under the MIT license. See the LICENSE file for more info.