IBM Support

Hello CMIS: Going Mobile with iOS and Swift

Technical Blog Post


Abstract

Hello CMIS: Going Mobile with iOS and Swift

Body

With the release of IBM Content Navigator on Cloud, customers are embracing the concept of cloud for managing their documents.  With IBM, they know the documents will be secured and hosted in an enterprise class data center.  The first 2 CMIS articles - "Hello Document" and "Developing Content Navigator on Cloud solutions" - I introduced the concept of CMIS in very easy to use examples.  This article takes a different approach and jumps right in with a more functional application that you can use as a base for your first iPhone application. 

Note that by utilizing Swift, this solution will not run on older versions of iOS. This sample was created with Xcode 6.0 running on a Mac.

Apache Chemistry makes it easy
As with the previous articles on CMIS, the Apache Chemistry Open CMIS library is the key to working with CMIS on the iPhone.  This is extremely helpful for developers because it eliminates the need to learn a different API for every platform.  Once you begin to understand OpenCMIS, you can quickly create apps running on any supported platform.

 

image

 

Step 1: In Xcode 6.0, create a new Single View Application named CMIS_Sample.

image

Step 2: Download Objective CMIS and add the CMIS header files to your project

image

Step 3: Add the binary libraries libObjectiveCMIS.a and SystemConfiguration.framework to the Build Phases

image

Step 4: Create a bridging header file to use the Objective-C based CMIS APIs within your Swift code.

image

Step 5: Add the Path to the bridging header file to the "Objective- C Bridging Header" property in your project's Build Settings

image

Step 6: In the bridging header file, import all the CMIS classes that are required for the project.

#import "CMISSession.h"
#import "CMISEnums.h"
#import "CMISRequest.h"
#import "CMISReachability.h"
#import "CMISFolder.h"
#import "CMISPagedResult.h"

Step 7: Build your own custom app! 

That last step is really the hard part.  To help out there, I have attached a sample application that enables the user to browse files and folders from their iOS device.  Code for the sample application can be found here.  Below is a screen shot of the running application.

image

 

Helpful Resources:

Sample code used in this article

Apache CMIS libraries for Objective-C

CMIS Development Forum - ask questions, get answers.

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSCTJ4","label":"Case Manager"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11281124