cloudkit 0.3.8

Safe Rust bindings for Apple's CloudKit framework — iCloud databases and sync on macOS
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import CloudKit
import Foundation

func ckEncodeAsset(_ asset: CKAsset) -> CKAssetPayload {
    CKAssetPayload(fileURL: asset.fileURL?.path ?? "")
}

func ckDecodeAsset(_ payload: CKAssetPayload) -> CKAsset? {
    guard !payload.fileURL.isEmpty else { return nil }
    return CKAsset(fileURL: URL(fileURLWithPath: payload.fileURL))
}

extension CKAsset {
    func bridgePayload() -> CKAssetPayload {
        ckEncodeAsset(self)
    }
}