ios & drupal

18
IOS DRUPAL Fotis Dimanidis @axaios iOS Devs Gr Drupal from an iOS developer’s point of view

Upload: fotis-dimanidis

Post on 08-Jul-2015

128 views

Category:

Software


0 download

DESCRIPTION

Drupal from an iOS developer’s point of view.

TRANSCRIPT

Page 1: iOS & Drupal

IOS DRUPAL

Fotis Dimanidis@axaios iOS Devs Gr

Drupal from an iOS developer’s point of view

Page 2: iOS & Drupal

MY BACKGROUND

• Familiar with CMS philosophy

• Really liked it

• CMS as a (mobile) backend?

• Familiar tool in a new role?

Page 3: iOS & Drupal

WHY CMS?• Backend and website (/web app) in a single package

• Ease of use

• Tons of modules

• No coding necessary (in most cases)

• Own the data

Page 4: iOS & Drupal

SO WHY DRUPAL?• Mature CMS

• Secure & Scalable (cloud ready)

• Flexible (postgreSQL, mongoDB etc.)

• API ready (Services, RESTWS, RESTful)

• Push notifications module

• Several other modules (Authentication, Rules, etc.)

Page 5: iOS & Drupal

DON’T WANT TO REST?• D7

• Drupal iOS SDK

• D8

• Drupal iOS SDK

• Drupal 8 iOS SDK

• DrupalRESTKit

Page 6: iOS & Drupal

D7 IOS SDK EXAMPLE• Install Drupal

• Create a new sample content type (w/ custom fields etc.)

• Install Services (w/ dependencies: Ctools, Libraries)

• Enable Services & Rest server

• Create an Endpoint

Page 7: iOS & Drupal

CREATING ENDPOINTS

Page 8: iOS & Drupal
Page 9: iOS & Drupal

THE CODE

Page 10: iOS & Drupal

OBJC: GET NODE TITLENSMutableDictionary *nodeData =

[NSMutableDictionary new];

[nodeData setObject:@"12" forKey:@"nid"];

[DIOSNode nodeGet:nodeData success: ^(AFHTTPRequestOperation *operation, id responseObject) { //Get the title _titleTextField.text =

[responseObject objectForKey:@"title"]; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { //We failed to get the node }];

Page 11: iOS & Drupal

NODE BODY JSON

"body": { "und": [ { "value": “Hello world.", "summary": "", "format": "filtered_html", "safe_value": "<p>Hello world.</p>\n", "safe_summary": "" } ] },

How do I get that???

Page 12: iOS & Drupal

OBJC: GET CUSTOM FIELD VALUE

//Needs the "field_" prefix

NSDictionary *languageDict =

[responseObject objectForKey:@“field_address"];

NSArray *bodyValues =

[languageDict objectForKey:@“und”];

NSDictionary *descDict =

[bodyValues objectAtIndex:0];

_addressTextField.text =

[descDict objectForKey:@"value"];

Page 13: iOS & Drupal

GITHUB EXAMPLES

• Human Alert w/ Drupal iOS SDK demo

• OpenDatasets iOS

• Demonstrates the use of Drupal 7 iOS SDK

Page 14: iOS & Drupal

D7 VS D8?

• Stay with D7 for now

• D8 still in beta

• No upgrade path between betas

• Modules (Rules, Push Notifications,…) not D8 ready

Page 15: iOS & Drupal

TIPS N’ TRICKS• Modules to use

• Geofield• Rules• Service Tools (Services versioning!)• Push Notifications• Services Entity API• Content API• Services Views (?)

• Use entities instead of nodes (ECK module)

• MongoDB module

• Node.js module (?!)

Page 16: iOS & Drupal

VSServices RESTWS RESTful

SDK available Querying filters Querying filters

Select specific fields (Content API) Return specific fields List all entities

Versioning (Service Tools) Resource documentation (json) Versioning

Many Services specific modules Autocomplete call

Bloated JSON Requires plugin coding

“field_” prefix

Attention: Non conclusive list!

Page 17: iOS & Drupal

WHY NOT DRUPAL• Performance overhead (PHP, mySQL, Drupal

Framework)

• Maturity of iOS SDK (vs popular backend SDKs [e.g. Parse])

• Learning curve (Drupal API for custom modules)

• Invest on an expiring version (D7)

Page 18: iOS & Drupal

THANK YOUFotis Dimanidis

@axaios