In a Nutshell
The iOS Framework is written in Objective-c language, but it can also be used in a Swift code. It contains all the code that a developer will need to connect to any of the supported Cloud Services, and to perform the supported Actions. In a series of articles we will describe this code and we will give example of its usage.
Even though you can import each class that is in the Framework individually, we propose to import the RainbowSDK.h file, as it imports all the classes.
In order to use the Framework we need to create an instance of the Rainbow class. We create a singleton instance of that class by calling the method “instance”:
Rainbow *rainbow = [Rainbow instance];
We use that instance to get the list of available Cloud Services. If a user is already connected to a service, that instance will give us an object of that account. Once we have that object we can perform all supported actions on that Cloud Account. But, before we get there it is important to describe the way that the Rainbow Framework is designed.
The code of the Rainbow SDK can be groupped in five categories:
- API: Code to connect to a Service and create an Account (ServiceItem)
- Service: Code that keeps track of the connected accounts (ServiceItems). It is also responsible for refreshing the Access Token
- ServiceItem: This object represents an account. It has all the variables that we need to connect to that account
- Cloud Manager: This is where the magic takes place. With this code we can perform all supported actions to an account.
- Transfer: Code that perform all kind of requests.
The code for each of these categories is located in a folder, and we find different files for each Cloud Service. Thus, in the folder “API”, we find the files: RIDriveAPI.h(m), RMediaFile.h(m), etc.
All classes start with an “R”. Thus, we have the RIDriveAPI.h and RIDriveAPI.m files. These two files have the API code for the iDrive Cloud Service.
The name of each of these categories is a link. Click on it to learn more about it. In the meantime, it is important to state here that in order to create an instance of a Cloud Manager, we need an instance of a ServiceItem class. All ServiceItems are stored in an instance of the Service class. The Service class, uses an instance of the API class to create an instance of a ServiceItem.
Even though the above looks cumbersome and difficult to comprehend, it is extremely easy to use. As you can see in the Demo code, the Rainbow SDK takes care of all these steps, and you do not need to worry about anything.
The Rainbow-SDK is tested on iOS. Because it uses code that is available in both platforms, you shouldn’t have any issues to use it on an OSX application. Still, if you do have any issue, contact us, and we will work together on that issue.