Skip to content

v0.4.0 — Metadata + overlay helpers

Choose a tag to compare

@SteliyanH SteliyanH released this 30 Apr 09:38
· 15 commits to main since this release

Closes the v0.x cycle. Surfaces PHAsset metadata as a kadr-side value type and adds thin helpers that bridge a PHAsset directly to kadr's overlay types.

What's new

import Kadr
import KadrPhotos

// Metadata snapshot
let meta = PhotosClipResolver.metadata(of: asset)
print(meta.creationDate, meta.location, meta.subtypes.contains(.livePhoto))

// Logo from Photos as a static ImageOverlay
let logo = try await PhotosClipResolver.imageOverlay(
    asset: logoAsset,
    position: .topRight,
    size: .normalized(width: 0.15, height: 0.15),
    anchor: .topRight
)

// Sticker with rotation + shadow
let sticker = try await PhotosClipResolver.stickerOverlay(
    asset: stickerAsset,
    position: .bottomLeft,
    rotation: -0.15,
    shadow: .init(color: .black, radius: 8, offset: .init(width: 4, height: 4), opacity: 0.6)
)

let video = Video {
    VideoClip(url: footage)
}
.overlay(logo)
.overlay(sticker)
  • `PhotoAssetMetadata` value type — `creationDate`, `modificationDate`, `location` (`CLLocation`), `pixelSize`, `videoDuration`, `subtypes`, `isFavorite`, `burstIdentifier`, `mediaKind`. `Equatable` + `@unchecked Sendable`.
  • `PhotoAssetSubtypes` OptionSet — kadr-side mirror of `PHAssetMediaSubtype` (`.livePhoto` / `.panorama` / `.hdr` / `.screenshot` / `.depthEffect` / etc.). `PhotoAssetSubtypes.from(_:)` exposes the bridge.
  • `PhotosClipResolver.metadata(of:)` — synchronous PHAsset property read; no iCloud round-trip.
  • `PhotosClipResolver.imageOverlay(asset:)` — PHAsset → `Kadr.ImageOverlay`.
  • `PhotosClipResolver.stickerOverlay(asset:)` — PHAsset → `Kadr.StickerOverlay` (adds rotation + shadow).

Compatibility

  • Requires kadr ≥ 0.9.2 (unchanged).
  • iOS 16+ / macOS 13+ / visionOS 1+. tvOS still excluded.
  • Pure additive — every v0.3 call site compiles unchanged.

Tests

Suite: 36 → 57 (+21).

v0.x cycle complete

KadrPhotos is now feature-complete on the originally-scoped surface:

  • v0.1.0 — video + image PHAsset resolution
  • v0.2.0 — Live Photo
  • v0.3.0 — `PhotoPicker` SwiftUI wrapper
  • v0.4.0 — metadata + overlay helpers

Full notes in CHANGELOG.md.