drupal 8 and ios - an open source app

13
Agenda Social - Drupal Meets iOS Introductions Overview - D8iOS by Michael Smith Demo by Vivek V. Pandya Q&A Drupal in a Can - Chingis Sandanov Closing Remarks and Giveaway - Tim Tonight, we will discuss an open source iOS application for Drupal 8, the latest version of the popular open source CMS framework,

Upload: littlemas

Post on 11-Apr-2017

266 views

Category:

Technology


1 download

TRANSCRIPT

Agenda• Social - Drupal Meets iOS • Introductions • Overview - D8iOS by Michael Smith • Demo by Vivek V. Pandya • Q&A • Drupal in a Can - Chingis Sandanov • Closing Remarks and Giveaway - Tim

Tonight, we will discuss an open source iOS application for Drupal 8, the latest version of the popular open source CMS framework,

DiOS8An iOS application for Drupal 8 ReSTful Services

Michael Smith and Vivek V. Panda, PikLips LLC

Why Drupal 8?

New Paradigm of CMS Framework

Powerful Admin and DevOps Structure, Tools, Ecosystem

Drupal is the 2nd Most Widely Used Open Source CMS Framework

I tried many content management systems — PHPnuke, XOOPs, DotNet Nuke. The reasons I chose Drupal was (1) it is really a framework as opposed to a package (though there are many distributions), and (2) the developer community is really great. There are over a million Drupal developers worldwide.

In a way, they are like Apple in that each new release reflects the changing times and challenges the developer community. This release is a great example of that. It overhauls everything from the way that modules and themes are created to the way that core was written. The good news for iOS is that Drupal now integrates HTTPRequest into core.

Who Uses Drupal?

Many Schools (https://groups.drupal.org/education-sites)

Many Governmental Agencies (https://groups.drupal.org/government-sites)

Many Large Corporations

Many SMBs

http://topdrops.org/https://www.drupal.com/showcases

Drupal is a very popular open source framework, with over a million developers and over a million websites worldwide. In the Bay Area, many prestigious and high-tech companies rely upon it.

What has been Missing?Drupal Mobile Meant “Responsive Design”

UX Built with Sass (CSS preprocessor) / Twig (Templating Engine) / Compass (Framework) / Symfony2 (IDE)

Mostly a Server Driven UI (until now)

Drupal was created as a vertically integrated web application, with extensibility built in using modules and themes. This PHP application has its roots in traditional, PC-oriented HTML/CSS but has changed many times to accommodate new needs. The new version includes many sophisticated tools for developing responsive design HTML/CSS/Javascript based user interfaces.

What is in it for an iOS Developer?

Drupal 8 ReSTful Interface

Works with Backbone.js, Angular.js, PhoneGap (DrupalGap), and iOS (via AFNetworking and Kyle Browning’s iOS SDK)

Free, Full-featured Backend for iOS App Development that You Do Not Have to Code.

Headless Drupal

However, it has gone beyond HTML to provide a complete ReSTful interface in core. Before Drupal 8, this was only possible via modules which made dependency management problematic. This change opens the door for mobile developers to use Drupal as a complete backend solution without the need to build it. Many call it headless Drupal, but I prefer to call it faceless Drupal, as the brains of Drupal are still there and of great use.

How?

Drupal Manages Users, Security, and Content via Admin UI

You Design the UX and Get the Content via JSON Objects

All I/O is via the iOS SDK (including parsing) and AFNetworking

Clean Abstraction Layer Between Your App Work and Drupal

Drupal allows iOS developers to create community applications not unlike Facebook, Pinterest or Snapchat without starting from scratch. Drupal profiles all the social connectivity support - user management, security, and content management. Its administrative services are very sophisticated, and it is readily extensible, with thousands of modules available.

D8IOS Specifics

CocoaPods Dependency Managerment (https://cocoapods.org/)

Alamofire Software Foundation’s AFNetworking Library (https://github.com/AFNetworking/AFNetworking)

Kyle Browning’s iOS SDK (https://github.com/kylebrowning/drupal-ios-sdk)

The D8iOS Application (https://github.com/PikLips/D8iOS)

Our application uses an SDK that creates a Drupal specific class of a library that abstracts Apple’s NSURLSession and NSURLConnection into a set of methods specific to Drupal. CocoaPods dependency management keeps everything in sync.

Kyle’s iOS-SDK DIOSSession Class

Subclass of AFHTTPRequestOperationManager

Drupal Specific (a way to tailor NSURLSession for Drupal)

Maps to Entities, Nodes, Fields, etc. in Drupal

This combination is like a tailor made connection service for iOS to use Drupal.

DIOSSession ExampleDIOSSession sendRequset method will add request parameters and headers as per the request type (i.e GET, POST, PATCH or DELETE ). It will also sign the request with credentials if specified, then add it to AFHTTPRequestOperationManager’s operation queue.

- (void) sendRequestWithPath:(NSString*)path method:(NSString*)method params:(NSDictionary*)params success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure { ... [localParams setObject:requestFormat forKey:@"_format"]; ... if ( _signRequests ) { NSURLCredential *credential = [NSURLCredential credentialWithUser:_basicAuthUsername password:_basicAuthPassword persistence:NSURLCredentialPersistenceNone]; [operation setCredential:credential]; } ... [self.operationQueue addOperation:operation]; }

APIs are like a piano. All the keys are there; you just need to know how to play them.

APIs

DIOSEntity - CRUD

DIOSView - GET

+ (void) getNodeWithID:(NSString*)eid success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure { [DIOSEntity getEntityWithName:@"node" andID:eid success:success failure:failure]; }

+ (void) getEntityWithName:(NSString*)name andID:(NSString*)eid success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure { NSString *path = [NSString stringWithFormat:@"%@/%@", name, eid]; [[DIOSSession sharedSession] sendRequestWithPath:path method:@"GET" params:nil success:success failure:failure];

While the SDK provides all the basic services, access to AFNetworking is always there to extend the service to new needs.

What is the Catch?

Understanding Drupal Schemas

Dynamic Scenes

Syncing Mobile and Web Release Updates

For now — Drupal 8 RC Issues

Of course, there is still a learning curve and, frankly, Drupal is still changing. RC1 is solid, but integration issues remain. However, most of these will be resolved by the end of 2015.

Demo Time!

Follow along at - https://github.com/PikLips/D8iOS

You can find the source code on GitHub, and a video of tonight’s meeting, including the demo is on YouTube - https://youtu.be/cZcxr_cSdCE .