Back to Labs

Swift components

Swift package catalog

Browse every package published by Nuancery Labs, with its source repository, API documentation, examples, and integration boundary.

Swift components

Components and responsibilities

Each component is extracted from production work and documents its API, supported platforms, dependencies, examples, and application-owned responsibilities.

KLRichTextEngine

v0.1.0

Keep rich-text documents editable without losing their authored structure.

A document codec and editor-routing layer for attributed text, checklist semantics, runtime metadata, and safe reconciliation of unsupported values.

  • Structured rich-text document encoding
  • Editable attributed-string conversion
  • Checklist semantics and runtime metadata

KLLazyGallery

v0.1.0

Load media progressively while keeping gallery state predictable.

A gallery coordination layer for lazy image and video loading, cancellation, dismissal, player release, and UIKit photo-browser integration.

  • Incremental image and video loading
  • Cancellation and request identity
  • Deterministic dismissal and player release

KLOCRPipeline

v0.1.0

Run OCR stages with explicit geometry and model boundaries.

A staged OCR pipeline for image preprocessing, Vision text recognition, reading-order reconstruction, and optional PaddleOCR Core ML inference.

  • Explicit preprocessing and recognition stages
  • Vision and optional PaddleOCR paths
  • Reading-order reconstruction through KLReadingOrder

KLPageCurl

v0.1.0

Add an accessible page-curl transition with a controlled fallback.

A SwiftUI transition layer that keeps page-curl presentation, accessibility behavior, and reduced-motion handling within a small integration boundary.

  • SwiftUI page-curl transition
  • Reduced-motion aware presentation
  • Accessibility-oriented transition behavior

KLGlassSegments

v0.1.2

Use navigation-style segmented controls across native glass and material fallback paths.

SwiftUI and UIKit segmented controls with generic selection identity, reselect callbacks, drag cancellation, accessibility identifiers, and Reduce Motion handling. Native glass is used where iOS provides it.

  • Binding-driven SwiftUI and UIControl-based UIKit APIs
  • Stable selection across refreshed generic segment IDs
  • Reselect, drag cancellation, and VoiceOver activation

KLAdaptiveSurface

v0.1.0

Normalize image-derived colors before they become muddy surfaces.

A synchronous color policy that keeps a source hue when possible, raises dark or overly saturated colors into a readable range, and selects a foreground color for the resulting surface.

  • Configurable brightness and saturation bounds
  • Dirtiness threshold to leave clean colors untouched
  • Preserve-hue, neutral, cool, and warm preferences

KLAdaptivePalette

v0.1.2

Derive a palette from the image region visible in a host container.

A Core Graphics palette analyzer that accounts for the host container, content mode, and crop anchor. It returns colors, ranked candidates, contrast-aware foregrounds, and a deterministic cache key.

  • Aspect-fill and aspect-fit visible-region analysis
  • Ranked perceptual color candidates
  • Foreground selection from actual background luminance

KLCalendarLanes

v0.1.0

Allocate deterministic lanes for multi-day all-day event bars.

A UI-independent layout engine for clipped calendar-grid ranges. It normalizes dates with the supplied Calendar, splits bars at row boundaries, and reports deterministic overflow and daily lane coverage.

  • Calendar-aware multi-day range normalization
  • Row-local segments with boundary flags
  • Deterministic lane allocation and overflow

KLShareLink

v0.1.0

Select an HTTP(S) URL from explicit input or shared text.

A synchronous resolver for explicit URLs, text candidates, provider domains, and legacy source markers. It performs no network requests and rejects documented local-address forms.

  • Provider-aware candidate precedence
  • HTTP(S)-only literal destination policy
  • JSON or value-based provider configuration

KLSubjectVision

v0.1.0

Create square subject or room thumbnails from a CGImage.

A synchronous thumbnail processor using Apple Vision, Core Image, and Core Graphics. It reports whether the result used a subject cutout, fallback, or room treatment.

  • Vision foreground instance masks
  • Aspect-fit cutout with explicit inset
  • Aspect-fill room and fallback treatment

KLCharts

v0.1.0

Render grouped bar data with Swift Charts or Canvas.

Flat and dimensional SwiftUI bar charts with application-owned selection, formatting, colors, and navigation. Geometry and hit-testing helpers are available for tests.

  • Flat and projected dimensional renderers
  • Selection, clear, viewpoint reset, and formatting callbacks
  • Dense-group horizontal expansion

KLReadingOrder

v0.1.0

Order OCR candidates into horizontal or vertical reading lines.

A synchronous geometry engine for horizontal, vertical, automatic, and multipage reading order. It preserves caller-owned candidate identifiers and does not perform OCR.

  • Horizontal rows and right-to-left vertical columns
  • Automatic direction inference per page
  • Adaptive median-based geometry tolerance