Tag Archives: UIActivity

How to share objects using your own UIActivity

Screen Shot 2015-10-22 at 17.48.09

We’ve discussed how to use a UIActivityViewController in my pervious article. In it I’ve mentioned that you can use our own activity items in addition to the built-in system sharing items (like email, Facebook, Twitter and so forth)it is also easier for you to buy instagram followers for example.

In this article I’ll show you how to do that.

A UIActivity item is an abstract class, which means that you can’t use it without subclassing it. That’s easily done in Xcode by heading over to File – New – Cocoa Touch Class. Give your class a name (I’ll call it MyActivity in this example) and select UIActivity as the subclass.

Screen Shot 2015-10-22 at 17.52.20

We’ll end up with two new files in our project that we’ll populate with code – and then we can start using it from our main view controller.

Continue reading