Skip to content

Releases

v1.0.0

Choose a tag to compare

@github-actions github-actions released this 10 Nov 01:00

DerivedKeys builds cache keys from the values a Swift computation depends on, then reuses matching results.

  • Cache UIKit measurements with SizeCache in DerivedKeysUI. Declare the properties that affect sizing, compose child caches to reuse an entire layout's size, and share results across equivalent view instances.
  • Bind other calculations to key paths with ResultCache in DerivedKeys or MainActorResultCache in DerivedKeysUI. The result-cache guide shows how to pass a rendered line count into a separate height cache, with text measurement and layout policy kept in application code.
  • Use the generic core for full-value keys, projections, dependency graphs, and bounded LRU memoization. DerivedKeysUI also provides explicit fitting proposals and LayoutCache for results such as an overall size and child frames.

Requirements:

  • Swift tools 6.4 and Swift 6 language mode
  • iOS 16.0+ or macOS 13.0+
  • UIKit for UIKit-specific APIs

Add the package with Swift Package Manager:

.package(url: "https://github.com/kylehughes/swift-derived-keys", from: "1.0.0")

See the README, cache contract, and result-cache guide for examples, ownership, and dependency rules.