Skip to main content

CloudikeDocumentWalletKit

SDK for storing and managing a user's documents (document wallet).

Applies to CloudikeDocumentWalletKit 0.8.16+

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:

~/.netrc
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 CloudikeDocumentWalletKit and its required CloudikeCoreKit dependency:

Podfile
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 'CloudikeDocumentWalletKit'
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 CloudikeDocumentWalletKit

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 = CloudikeDocumentWalletSettings(
isPermissionsRequestAllowed: true,
competition: .init(mode: .standalone, appGroupId: nil, lastActivityMaxInterval: 60),
apiBaseURL: apiBaseUrl,
apiUserId: userId,
apiToken: apiToken,
userAgent: "YourApp/1.0"
)

let documentWallet = CloudikeDocumentWallet(
settings: settings,
core: core,
networkMonitor: NetworkMonitor(), // ready-made CloudikeCoreKit implementation
thumbnailGenerator: ThumbnailGenerator(), // ready-made CloudikeCoreKit implementation
storageSizeUpdater: StorageInfo(), // ready-made CloudikeCoreKit implementation
externalLogHandler: nil
)

let uploadSettings = CloudikeDocumentWalletAutoUploadSettings(
minBatteryLevel: 0.15,
maxRetryCount: 3,
isBackgroundAutoUploadEnabled: false
)

documentWallet.configureWithUploadSettings(uploadSettings, in: false) { error in
guard error == nil else {
// handle setup failure
return
}
// documentWallet.documentService is now available
}

Creates a CloudikeCore session and authenticates it, then creates a CloudikeDocumentWallet instance built on that session — using the ready-made NetworkMonitor, StorageInfo, and ThumbnailGenerator implementations from CloudikeCoreKit — and finishes setup with configureWithUploadSettings(_:in:with:). documentService is only available after this completes successfully.

First API Call

Task {
let exists = try await documentWallet.documentService.isDocumentWalletExist()
print("Document wallet already exists:", exists)
}

Checks whether a document wallet has already been created for this user. Call this first to decide whether to show wallet-creation or sign-in UI. Prints true or false once the check completes.