Skip to content

v0.1.0 — Video + image PHAsset resolution

Choose a tag to compare

@SteliyanH SteliyanH released this 30 Apr 06:28
· 31 commits to main since this release

First release of kadr-photos — Photos library integration for kadr.

What's new

import Kadr
import KadrPhotos
import Photos

let videoClip = try await PhotosClipResolver.video(asset: phVideoAsset) { progress in
    iCloudProgressBar.fractionCompleted = progress
}

let imageClip = try await PhotosClipResolver.image(asset: phImageAsset, duration: 3.0)

let video = Video {
    videoClip
    imageClip
}
  • `PhotosClipResolver.video(asset:options:progress:)` — async, returns `VideoClip`. Downloads from iCloud if needed, then re-encodes via `AVAssetExportSession` to a temp `.mp4`.
  • `PhotosClipResolver.image(asset:duration:options:progress:)` — async, returns `ImageClip` at the requested target size. `CMTime` and `TimeInterval` overloads.
  • `Options` — image target size, content mode, delivery mode, video export preset. Sensible defaults.
  • `PhotosClipError` — typed errors: `unauthorized`, `wrongMediaType`, `missingMedia`, `iCloudDownload`, `videoExportFailed`.
  • iCloud download progress via `@Sendable (Double) -> Void` callback.
  • `ImageContentMode` / `ImageDeliveryMode` re-exported subsets so consumers don't need to import `Photos` for option setting.

Compatibility

  • Requires kadr ≥ 0.9.2.
  • iOS 16+, macOS 13+, visionOS 1+. tvOS excluded — `Photos.framework` unavailable on tvOS.
  • Required entitlement (consumer): `NSPhotoLibraryUsageDescription`.
  • No third-party dependencies. Pure Swift + Foundation + AVFoundation + Photos.

Tests

15 unit tests covering pure helpers (mappings, options, target sizes, error equality). PHAsset-backed paths require a real photo library + authorization and are covered by integration testing in consuming apps.

What's next

  • v0.2.0 — Live Photo support (still + motion as a unit)
  • v0.3.0+ — `PHPickerViewController` SwiftUI wrapper

Full notes in CHANGELOG.md.