Our Global Presence :

Creating a Mobile App to Download Images from IBM Cloud Object Storage

by

Daljit Singh

linkedin profile

20 MIN TO READ

March 6, 2019

Creating a Mobile App to Download Images from IBM Cloud Object Storage

by

Daljit Singh

linkedin profile

20 MIN TO READ

March 6, 2019

Table of Contents

Mobile applications are becoming more prevalent by the day, and more apps are starting to be dependent on cloud storage in order to free up space on the users’ devices. This code pattern will show you how to download images from Cloud Object Storage as well as compare them to images downloaded from a traditional server.

Cloud Object Storage

The IBM Cloud Object Storage provides flexible and easily scalable cloud storage options for unstructured data. Cloud Object Storage makes it possible to store large amounts of data in an efficient manner. With virtually unlimited storage space for data, it is often used for archiving and backup. It is also used for web and mobile applications, and its easy scalability encourages the use of persistent storage for analytics. IBM Aspera is pre-integrated to provide a high-speed data transfer to and from Cloud Object Storage, and query-in-place functionality allows easy running of analytics on your stored data.

Use Case

Mobile applications can often interact with data that is stored in the cloud as objects. This data is stored not only as a backup, storage, and archive but also for persistent storage for analytics. As data can be accessed in real time, it allows for the efficient and easy running of analytics on the stored and regularly updated data. In this code pattern, you will create an example Swift application that can be used to compare images that are downloaded from a traditional server and images that are stored in the Cloud Object Storage.

This mobile app can be used in photo-sharing apps, comparison apps, identifier applications, and many more that require storage and/or comparative capabilities. It can also be used to identify similar images, which can have applications in online retail and e-commerce websites. The ease of running analytics also allows data to be processed in real time, which helps increase the efficiency of the organization.

Development and Process Description

This code pattern is an “Image Downloader” app that compares downloaded images from a traditional server (for which one can use any online source of information, for example, Wikipedia) and images from IBM Cloud Object Storage on the phone. The images are stored in the Cloud Object Storage as objects in one bucket and as compressed file archives in another bucket. Hence, in this code pattern, you have to first create an iOS Swift application, as the phone, we are using in this example is an iPhone. After this, you have to integrate the IBM Cloud Object Storage into the aforementioned Swift application.

Once this is done, the user can interact with the Swift app to download the objects (in this case, images) from IBM Cloud Object Storage. The app then makes the relevant calls to the Cloud Object Storage and receives the access token and the list of bucket objects. It will then proceed to download the objects. The images are then downloaded and displayed to the user.

Process Flow

In this Code Pattern, we will look at comparing downloading Atlantic Hurricane Season images from a traditional server (Wikipedia in this case) and Cloud Object Storage on an iPhone. The images are stored in Cloud Object Storage as objects in one Bucket and a Zip archive in another Bucket.

When the reader has completed this Code Pattern, they will understand how to:

  • Create an iOS Swift application
  • Incorporate Cloud Object Storage into a Swift application

Architecture

1.    The user interacts with the app to start a download of objects (images) from Cloud Object Storage.

2.    The app makes the necessary calls to Cloud Object Storage to get the access token, and list of bucket objects, and download the objects (images).

3.    The images are downloaded and displayed on the app to the user.

Steps To Follow

Here are the steps to Creating a Mobile App to Download Images from IBM Cloud Server

1.    Clone the repo

2.    Install developer tools

3.    Install dependencies

4.    Create Cloud Object Storage Buckets

5.    Run in Xcode

1. Clone the repo

Clone the repo locally. In a terminal, run:

$ git clone https://github.com/IBM/swift-cloud-object-storage-example

$ cd swift-cloud-object-storage-example

2. Install developer tools

Ensure you have the required developer tools installed from Apple:

iOS 12.0+

Xcode 10.0+

Swift 4.0+

3. Install dependencies

This code pattern uses Alamofire, Kanna, ZIPFoundation, and SwiftyPlistManager which all work with CocoaPods to manage and configure dependencies.

You can install CocoaPods using the following command:

$ sudo gem install cocoapods

If the CocoaPods repository is not configured, run the following command (this may take a long time depending on your network connection and installation state):

$ pod setup

A pre-configured Podfile has been included in this repository. To download and install the required dependencies, run the following command from your project directory:

$ pod install

If you run into any issues during the pod install, it is recommended to run a pod update by using the following commands:

$ pod update

$ pod install

Finally, open the Xcode workspace: ImageDownloader.xcworkspace.

4. Create Cloud Object Storage Buckets

5. Run in Xcode

In Xcode, click Product Run to start the iOS application. Choose which download type to use for downloading the images from the Picker View. The download history results are logged in the History tab.

blog-image

November 7, 2023

Leave a Comment


USA

Debut Infotech Global Services LLC

2102 Linden LN, Palatine, IL 60067

+1-703-537-5009

[email protected]

UK

Debut Infotech Pvt Ltd

7 Pound Close, Yarnton, Oxfordshire, OX51QG, England

+44- 770 -304-0079

[email protected]

Canada

Debut Infotech Pvt Ltd

326 Parkvale Drive, Kitchener Ontario, N2R1Y7

+1-703-537-5009

[email protected]

INDIA

Debut Infotech Pvt Ltd

C-204, Ground floor, Industrial Area Phase 8B, Mohali 160055

9888402396

[email protected]