DebugSnapshots, a Swift library from Point-Free, has entered public beta. It provides debugging and exhaustive testing tools for reference types, particularly @Observable classes in SwiftUI apps. The @DebugSnapshot macro generates a snapshot value representing model state, enabling diff-based logging of state changes on every method call via OSLog (debug builds only). For testing, the expect() function allows exhaustive assertions on state transitions — if any unaccounted state changes occur, the test fails with a focused diff. The library supports fine-grained control via @LogChanges, @DebugSnapshotTracked, @DebugSnapshotIgnored, and @DebugSnapshotConvertible macros, and handles nested models and enums. It uses the CustomDump library under the hood for focused diffs on large collections.

6m read timeFrom pointfree.co
Post cover image
5.3K Impressions