Building your first iOS app with Hoodie

Building your first iOS app with Hoodie

Slides of the presentation at Cococoheads Berlin from 21.05.14 about how to build an offline first iOS app with Hoodie as Backend.

23e1eeb1ce09429cbb13a3c40d508626?s=128

Katrin Apel

May 21, 2014
Tweet

Transcript

  1. Building your first Hoodie iOS app

  2. @kaalita Katrin Apel Freelance iOS developer, former product manager, HOOHoodie

    maintainer
  3. Repetitive Backend Stuff

  4. Repetitive Backend Stuff Creating user accounts

  5. Repetitive Backend Stuff Creating user accounts User authentication

  6. Repetitive Backend Stuff Creating user accounts User authentication User administration

  7. Repetitive Backend Stuff Creating user accounts User authentication User administration

    Storing & retrieving data
  8. Repetitive Backend Stuff Creating user accounts User authentication User administration

    Storing & retrieving data Sharing data
  9. There is a Pod for that. HOO

  10. $ brew update! $ brew install git! $ brew install

    node! $ brew install couchdb! $ npm install -g hoodie-cli Install Hoodie & dependencies
  11. $ hoodie new mynewapp! $ cd mynewapp! $ hoodie start

    Create Hoodie App
  12. Get HOOHoodie pod ‘HOOHoodie’ , ‘0.2.1’

  13. Create HOOHoodie instance #import “HOOHoodie.h" ! ! NSURL *baseURL =

    [[NSURL alloc] initWithString:@"http://localhost:6001/_api"]; ! self.hoodie = [[HOOHoodie alloc] initWithBaseURL:baseURL];
  14. Sign Up [self.hoodie.account signUpUserWithName:@"kaalita" password:@"secretpassword" onSignUp: ^(BOOL signUpSuccessful, NSError *error)

    { ! }];
  15. Sign In [self.hoodie.account signInUserWithName:@"kaalita" password:@"secretpassword" onSignIn: ^(BOOL signInSuccessful, NSError *error)

    { ! }];
  16. Save data NSDictionary *newUnicorn = @{@"name": @"Primrose Rainbow Mane"}; !

    [self.hoodie.store saveObject:newUnicorn withType:@"unicorn" onSave: ^(NSDictionary *savedObject, NSError *error) { ! }];
  17. Retrieve data ! // Retrieve all objects of one type

    ! ! NSArray *unicorns = [self.hoodie.store findAllObjectsWithType:@"unicorn"]; ! ! // Retrieve object by id ! NSDictionary *myUnicorn = [self.hoodie.store findObjectWithID:@"unicorn/08858vp" andType:@"unicorn"];
  18. The Hoodie Offline Magic Image Credit: Adventure Time http://images.wikia.com/adventuretimewithfinnandjake/images/archive/0/09/20110723003641!FinnMagicWand.gif

  19. BACKEND Your App

  20. BACKEND Your App

  21. BACKEND Your App

  22. BACKEND Your App

  23. Your App BACKEND Synching Plugins

  24. Image Credit: Adventure Time http://www.hdwpapers.com/lady_rainicorn_wallpaper_2-wallpapers.html

  25. Find and report ALL THE BUGS Image Credit: Bugs http://visualdesignworkshop.com/wp-content/uploads/2013/10/Natural-History-Insects.png

  26. Tell your wishes Image Credit: Aladdin http://www.greenbookblog.org/wp-content/uploads/2012/07/Genie-disney-sidekicks-8531037-1024-768.jpg

  27. F U R T H E R R E S

    O U R C E S • Hoodie Website: http://hood.ie/ • HOOHoodie: https://github.com/kaalita/Hoodie-iOS • Plugin Tutorial: https://github.com/espy/hoodie-plugin-tutorial • Nodejitsu Deployment: https://github.com/hoodiehq/my-first- hoodie#deploy-to-nodejitsu • Hoodie Chat: irc.freenode.net/#hoodie ! • On Twitter: @hoodiehq Image Credit: Adventure Time: http://www.fanaru.com/adventure-time/image/14003/jake-reading-a-book-wallpaper/