Download - iOS & Drupal
![Page 1: iOS & Drupal](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/1.jpg)
IOS DRUPAL
Fotis Dimanidis@axaios iOS Devs Gr
Drupal from an iOS developer’s point of view
![Page 2: iOS & Drupal](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/2.jpg)
MY BACKGROUND
• Familiar with CMS philosophy
• Really liked it
• CMS as a (mobile) backend?
• Familiar tool in a new role?
![Page 3: iOS & Drupal](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/3.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/4.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/5.jpg)
DON’T WANT TO REST?• D7
• Drupal iOS SDK
• D8
• Drupal iOS SDK
• Drupal 8 iOS SDK
• DrupalRESTKit
![Page 6: iOS & Drupal](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/6.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/7.jpg)
CREATING ENDPOINTS
![Page 8: iOS & Drupal](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/8.jpg)
![Page 9: iOS & Drupal](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/9.jpg)
THE CODE
![Page 10: iOS & Drupal](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/10.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/11.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/12.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/13.jpg)
GITHUB EXAMPLES
• Human Alert w/ Drupal iOS SDK demo
• OpenDatasets iOS
• Demonstrates the use of Drupal 7 iOS SDK
![Page 14: iOS & Drupal](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/14.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/15.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/16.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052413/559c55ef1a28ab991c8b476b/html5/thumbnails/17.jpg)
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)