$30 off During Our Annual Pro Sale. View Details »

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
Tweet

More Decks by Bryan Irace

Other Decks in Programming

Transcript

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

    View Slide

  2. Intents
    Contracts

    View Slide

  3. …URLs?

    View Slide

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

    View Slide

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

    View Slide

  6. We can fix some of these
    shortcomings
    • Time spent writing client code
    !
    • Bugs

    View Slide

  7. CocoaPods

    View Slide

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

    View Slide

  9. Tumblr iOS SDK
    github.com/tumblr/
    TMTumblrSDK

    View Slide

  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

    View Slide

  11. Please actually
    implement the
    “callback” part

    View Slide

  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

    View Slide

  13. + (void)viewBlog:(NSString *)blogName;
    !
    + (void)createTextPost:(NSString *)title
    body:(NSString *)body
    tags:(NSArray *)tags
    success:(NSURL *)successURL
    cancel:(NSURL *)cancelURL;
    pod install TMTumblrSDK

    View Slide

  14. UIActivityViewController

    View Slide

  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

    View Slide

  16. UIDocumentInteractionController

    View Slide

  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

    View Slide

  18. Publish an official API client
    Every app is different. Make it easy
    for developers to hit your API
    directly if they’d prefer.

    View Slide

  19. Subspecs
    • TMTumblrSDK/URLSchemes
    !
    • TMTumblrSDK/Activity
    !
    • TMTumblrSDK/DocumentInteraction
    !
    • TMTumblrSDK/APIClient
    • TMTumblrSDK/APIClient/Authentication
    Don’t make developers include more
    code than they want to

    View Slide

  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

    View Slide