Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building apps that play nicely with other apps

Bryan Irace
November 21, 2013

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

More Decks by Bryan Irace

Other Decks in Programming


  1. Building apps that play nicely with other apps Bryan Irace

  2. Intents Contracts

  3. …URLs?

  4. URLs have shortcomings Like manually, explicitly defining all interactions between

  5. We can fix some of these shortcomings • Documentation !

    • Discovery
  6. We can fix some of these shortcomings • Time spent

    writing client code ! • Bugs
  7. CocoaPods

  8. It’s OK to be selfish Provide code that helps others

    integrate with you
  9. Tumblr iOS SDK github.com/tumblr/ TMTumblrSDK

  10. 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
  11. Please actually implement the “callback” part

  12. 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
  13. + (void)viewBlog:(NSString *)blogName; ! + (void)createTextPost:(NSString *)title body:(NSString *)body tags:(NSArray

    *)tags success:(NSURL *)successURL cancel:(NSURL *)cancelURL; pod install TMTumblrSDK
  14. UIActivityViewController

  15. @implementation TMTumblrActivity ! - (NSString *)activityTitle { return @"Tumblr"; }

    ! - (UIImage *)activityImage { return [UIImage imageNamed:@"UIActivityTumblr"]; } ! - (void)performActivity { // Open Tumblr app or hit API directly } pod install TMTumblrSDK
  16. UIDocumentInteractionController

  17. + (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
  18. Publish an official API client Every app is different. Make

    it easy for developers to hit your API directly if they’d prefer.
  19. Subspecs • TMTumblrSDK/URLSchemes ! • TMTumblrSDK/Activity ! • TMTumblrSDK/DocumentInteraction !

    • TMTumblrSDK/APIClient • TMTumblrSDK/APIClient/Authentication Don’t make developers include more code than they want to
  20. 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