ShareKit : Drop-in Share Features for all iOS Apps.
“Add full sharing capabilities to your app w/ just 3 lines of code”…
Delicious, Email, Facebook, Google Reader, Twitter, URLs, images, text, files… and more. Customizable UI and Open Source too!
Well, it is technically 3 lines of code but of course there’s more involved. Either way it’s pretty quick and easy.
I wrote a method (shareIt below) to use their action sheet like their example, but then I wanted to go directly to specific sharing and avoid the overwhelming list they offer (their action sheet gives access to all the applicable ways to share what you’re trying to share so for URL it’s a LOT of ways).
This doesn’t include installation, import and API keys setup.
Again, it’s pretty awesome and very easy compared to routes I’ve taken in the past!
[sourcecode]
// use the ShareKit ActionSheet
-(void)shareIt;
{
NSString *name = [self itemName];
NSString *url = [self itemLink];
SHKItem *item = [SHKItem URL:[NSURL URLWithString:url] title:name];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
[actionSheet showFromToolbar:tbBtns];
}
// share directly from my button or similar
-(void)shareEmail;
{
NSString *name = [self itemName];
NSString *url = [self itemLink];
[SHKMail shareURL:[NSURL URLWithString:link] title:name];
}
// share directly from my button or similar
-(void)shareFacebook;
{
NSString *name = [self itemName];
NSString *url = [self itemLink];
NSURL *url = [NSURL URLWithString:link];
SHKItem *item = [SHKItem URL:url title:name];
[SHKFacebook shareItem:item];
}
// share directly from my button or similar
-(void)shareTwitter;
{
NSString *name = [self itemName];
NSString *url = [self itemLink];
NSURL *url = [NSURL URLWithString:link];
SHKItem *item = [SHKItem URL:url title:name];
[SHKTwitter shareItem:item];
}
[/sourcecode]