CloudikePhotosKit
SDK for working with Cloudike photos and albums — gallery, albums, cover images.
Applies to CloudikePhotosKit 4.10.6+
Installation
Cloudike SDKs for iOS are distributed through CocoaPods as prebuilt dynamic XCFrameworks from Cloudike's private pod repository.
1. Set up access (once per machine). Cloudike provides you with a username and a deploy token. Add them to ~/.netrc — both git (to fetch the pod specs over HTTPS) and curl (which CocoaPods uses to download the framework archives) read credentials from this file:
machine git.cloudike.com login <username> password <token>
Make the file readable only by you:
chmod 600 ~/.netrc
2. Add the SDK to your Podfile. Declare the Cloudike pod repository as a source and add CloudikePhotosKit and its required CloudikeCoreKit dependency:
source 'https://git.cloudike.com/cloudike-ios/pod_spec_binary.git'
source 'https://cdn.cocoapods.org/'
platform :ios, '13.0'
use_frameworks!
target 'YourApp' do
pod 'CloudikePhotosKit'
pod 'CloudikeCoreKit'
end
- The
https://cdn.cocoapods.org/source is needed for the SDKs' third-party dependencies (for example, Kingfisher used by CloudikeDocumentWalletKit). use_frameworks!is required — the SDKs are shipped as dynamic frameworks.- The minimum supported iOS version is 13.0.
3. Install the pods:
pod install
Initialization
import CloudikeCoreKit
import CloudikePhotosKit
let apiBaseUrl = URL(string: "https://your-api-endpoint.example.com")! // your Cloudike API endpoint
let core = CloudikeCore(apiBaseUrl: apiBaseUrl)
core.applyUser(apiToken: apiToken, userId: userId, deviceId: deviceId) // values from your sign-in flow
let settings = CloudikePhotosSettings(
isPermissionsRequestAllowed: true,
competition: .init(mode: .standalone, appGroupId: nil, lastActivityMaxInterval: 60),
apiBaseURL: apiBaseUrl,
apiUserId: userId,
apiToken: apiToken,
userAgent: "YourApp/1.0"
)
let photos = CloudikePhotos(
settings: settings,
core: core,
networkMonitor: NetworkMonitor(), // ready-made CloudikeCoreKit implementation
storageSizeUpdater: StorageInfo(), // ready-made CloudikeCoreKit implementation
userLanguage: { "en" },
onUserChangedCallback: { _ in },
externalLogHandler: nil
)
let uploadSettings = CloudikeAutoUploadSettings(
isAutoUploadEnabled: true,
is3gUploadEnabled: false,
isVideoUploadEnabled: true,
minBatteryLevel: 0.15,
maxRetryCount: 3,
isPhotosUploadFirst: true,
isBackgroundAutoUploadEnabled: false,
isRestoreEnabled: true
)
photos.configureWithUploadSettings(uploadSettings, in: false) { error in
guard error == nil else {
// handle setup failure
return
}
// photos is now ready to use
}
Creates a CloudikeCore session and authenticates it, then creates a CloudikePhotos instance built on that session — using the ready-made NetworkMonitor and StorageInfo implementations from CloudikeCoreKit instead of writing custom ones — and starts it with auto-upload settings.
First API Call
photos.uploadStatusDidChange = { status in
print("Upload status:", status)
}
photos.updateLocal()
Refreshes the local photo library from the device and resumes upload. uploadStatusDidChange fires as the auto-upload status changes (e.g. uploading, paused, completed) — confirming the SDK picked up the device's photo library.
Logout
photos.logout()
Call this when the user signs out of the app. It releases resources tied to the current session — including stopping background processes such as auto-upload (see the Autoupload guide) — so the SDK doesn't stay configured for the previous user. logout() takes no parameters and has no completion handler — it's a synchronous call and there's no result to wait for.