Stuart Breckenridge


Update: SLComposable is available on Cocoapods:
pod "SLComposable"

I’m in the process of rebuilding an old demo app I created three years ago for the Social framework. In that demo app I created individual instance methods for creating an SLComposeViewController with initial text, with initial text and an image, for each social network, and so on.

With the rebuild, I’ve gone about it a different way. I’ve created a protocol, SLComposable, which defines one method:

func composePost(text text:String?, image:UIImage?, url:NSURL?, network: SLComposableServiceType)

That’s it. One method for all social networks supported on iOS.

It’s been extended to UIViewController with an implementation that will check if posting to the specified social network is allowed, and if it isn’t it will present an UIAlertController to the user.

The full gist is below: