Skip to main content

Getting Started

Requirements#

  • Xcode 10.3 or later
  • CocoaPods 1.4.0 or later
  • Target of iOS 10 or later
  • Swift 5+

Before You Begin#

This SDK is stored in the private pod repo and developed for use with the Cloudike Backend. If you need access, please Contacts Us.

Installation#

Add SDK to your app#

The Cloudike Photos SDK is available through CocoaPods or XCFramework static library. To install it, simply add the following lines to your Podfile:

# Add Cloudike podspec to sourcessource 'git@bitbucket.org:asdtech/pod_spec.git'
target 'YourApp' do    # Add CloudikePhotosKit as dependency to your target    pod 'CloudikePhotosKit', '~> 0.2.10'end

Initialization#

Initialization is performed in two stages.

Stage 1. Initialize library.#

To initialize an instance of CloudikePhotos, you need to add the following calls:

var photos: CloudikePhotos?
let apiBaseURL = URL(string: "Base URL of the backend")!let token = "Authentication token received during user login"let userId = "User profile id"let userAgent = "User agent string"
let core = CloudikeCore(apiBaseUrl: apiBaseURL)core.applyUser(apiToken: token,               userId: userId,               deviceId: "Unique device id",               userAgent: userAgent)                let competitionSettings = CloudikePhotosSettings.CompetitionSettings(mode: .standalone,                                                                      appGroupId: nil,                                                                      lastActivityMaxInterval: 3600)let settings = CloudikePhotosSettings(isPermissionsRequestAllowed: true,                                      competition: competitionSettings,                                      apiBaseURL: apiBaseURL,                                      apiUserId: userId,                                      apiToken: token,                                      userAgent: userAgent)
self.photos = CloudikePhotos(settings: settings, core: core)

Stage 2. Configuration.#

To configure an instance of CloudikePhotos, you need to add the following calls:

let uploadSettings = CloudikeAutoUploadSettings(isAutoUploadEnabled: true,  // auto upload on/off                                                is3gUploadEnabled: true,    // cellular data upload allowed                                                isVideoUploadEnabled: true, // video upload allowed                                                minBatteryLevel: 0.3,       // minimum battery charge for auto upload                                                maxRetryCount: 0,           // the maximum number of attempts to upload a photo/video file to the cloud.                                                                            // If 0, then the number of attempts is not limited. If 1 - only one attempt is given, etc.                                                isPhotosUploadFirst: false,  // If true, photos will be uploaded first, then videos. If false, the priority is not defined.                                                isBackgroundAutoUploadEnabled: false // set to true if your app is considered to upload photo/video while being in background mode                                                )
let background = UIApplication.shared.applicationState == .backgroundself.photos.configureWithUploadSettings(uploadSettings, in: background) { (error) in    // completion block}

Dependencies#

Our SDK uses the following dependencies:

// ASDtechpod 'CloudikeCoreKit', '1.0.0'