I am trying to share an animated GIF but default UIActivityViewController Twitter share doesn't support it yet which it will "scale down" it as a still JPG, I have to use SLRequest for it as taught in this article. The downside of that is no preview share sheet and users cannot type their own message anymore.
However, I saw SteppyPants that it seems using a custom action after users click "share" in Twitter share sheet, how can they do it?
In other word, how to replace the UIActivityViewController twitter share action to a custom action which includes SLRequest.
Things I tried:
- UIActivityItemProvider and check UIActivityTypePostToTwitter, but that's run after user click twitter and before editing the text
- In UIActivityViewController completionWithItemsHandler delete the just twitted post (with still gif) and post again with SLRequest, but not too sure if I can delete the old post and it's consuming network bandwidth for users anyway
- SLComposeViewController, does not support animated GIF upload and not custom share action at all
P.S. I am iOS newb


That's pretty close!
I believe Steppy Pants is doing what you said; providing a
UIActivityItemProviderto theUIActivityViewController, but with a twist.When the
UIActivityItemProvider'sitemmethod is called, it checks if theUIActivityTypeisUIActivityTypePostToTwitterand if so, theUIActivityViewControlleris dismissed and a customSLComposeServiceViewControlleris presented.If you look closely you can see: The presented view controller doesn't have a title and the remaining character count doesn't respond correctly to URLs. The
SLComposeServiceViewControllerobject then implementsdidSelectPostto present a spinner UI while it initiates anSLRequest.