Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Building apps that play nicely with other apps
Bryan Irace
November 21, 2013
Programming
1
240
Building apps that play nicely with other apps
Given at the NYC CocoaPods meetup ("Cocoa Kucha") on November 20, 2013.
Bryan Irace
November 21, 2013
Tweet
Share
More Decks by Bryan Irace
See All by Bryan Irace
irace
1
480
irace
2
1.2k
irace
0
510
irace
0
110
irace
7
1.3k
irace
5
680
irace
5
450
irace
1
98
irace
7
480
Other Decks in Programming
See All in Programming
tetsukick
0
170
minamijoyo
3
460
numeroanddev
1
210
saten
1
170
masui_masanori
1
250
keiichihirobe
1
110
emmaglorypraise
0
120
joergneumann
0
130
hassaku63
1
700
bbatsov
0
110
ntaro
0
160
danilop
0
220
Featured
See All Featured
mojombo
358
62k
malarkey
393
61k
productmarketing
5
710
reverentgeek
168
7.2k
gr2m
83
11k
bkeepers
52
4.2k
jrom
116
7.2k
chriscoyier
684
180k
brad_frost
157
6.4k
bryan
100
11k
scottboms
251
11k
jasonvnalue
82
8.1k
Transcript
Building apps that play nicely with other apps Bryan Irace
Intents Contracts
…URLs?
URLs have shortcomings Like manually, explicitly defining all interactions between
apps
We can fix some of these shortcomings • Documentation !
• Discovery
We can fix some of these shortcomings • Time spent
writing client code ! • Bugs
CocoaPods
It’s OK to be selfish Provide code that helps others
integrate with you
Tumblr iOS SDK github.com/tumblr/ TMTumblrSDK
x-callback-url.com [scheme]://x-callback-url/ [action]?[x-callback parameters]&[action parameters] Used in Byword, Drafts, Instapaper,
Google Maps, Google Chrome, TextExpander, and many more
Please actually implement the “callback” part
URLs tumblr://x-callback-url/blog? blogName=bryan&postID=43724939726 ! tumblr://x-callback-url/text? title=Title&body=Body&tags=gif&tags=lol Hope others both find
and properly implement them
+ (void)viewBlog:(NSString *)blogName; ! + (void)createTextPost:(NSString *)title body:(NSString *)body tags:(NSArray
*)tags success:(NSURL *)successURL cancel:(NSURL *)cancelURL; pod install TMTumblrSDK
UIActivityViewController
@implementation TMTumblrActivity ! - (NSString *)activityTitle { return @"Tumblr"; }
! - (UIImage *)activityImage { return [UIImage imageNamed:@"UIActivityTumblr"]; } ! - (void)performActivity { // Open Tumblr app or hit API directly } pod install TMTumblrSDK
UIDocumentInteractionController
+ (UIDocumentInteractionController *)presentInteractionControllerWithURL:(NSURL *)URL caption:(NSString *)caption tags:(NSArray *)tags fromBarButtonItem:(UIBarButtonItem *)item
{ UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:URL]; controller.UTI = @"com.tumblr.photo"; controller.annotation = @{ @"TumblrCaption" : caption, @"TumblrTags" : tags }; ! [controller presentOpenInMenuFromBarButtonItem:item animated:YES]; return controller; } pod install TMTumblrSDK
Publish an official API client Every app is different. Make
it easy for developers to hit your API directly if they’d prefer.
Subspecs • TMTumblrSDK/URLSchemes ! • TMTumblrSDK/Activity ! • TMTumblrSDK/DocumentInteraction !
• TMTumblrSDK/APIClient • TMTumblrSDK/APIClient/Authentication Don’t make developers include more code than they want to
Summary You should make it easy for developers to integrate
with your app ! Providing code via CocoaPods is obviously the best way to do so com/jobs