Skip to content

Revision of API to follow SwiftUI declarative idioms

Latest

Choose a tag to compare

@alldritt alldritt released this 16 Feb 23:33
· 1 commit to main since this release

Here's what's new in v0.2.0:

  • Data-Driven Initializers -- Pass a collection directly (like List or ForEach) instead of using a content closure. Supports both Identifiable collections and explicit id: key paths.

  • Dynamic Data Handling -- When the backing collection changes (appends, replacements), empty deck slots are automatically filled with new cards. Uses element identity to detect changes.

  • currentItem: Binding -- Track which element is on top of the stack via a read-only binding that updates as cards are swiped and becomes nil when the deck is exhausted.

  • Per-Card Action Callbacks -- Attach onZLSwipeStarted, onZLSwiped, onZLSwipeCancelled, etc. to individual cards or subviews, not just the container.

  • SwipeableViewReader -- Programmatic control via a proxy object (following the ScrollViewReader pattern) with swipe(_:), rewind(), discardTop(), canSwipe, and canRewind.

  • CardView Component -- Built-in rounded rectangle card with shadow for quick prototyping.

  • Renamed Callback API -- onDidStart/onDidEnd/onDidCancel renamed to onZLSwipeStarted/onZLSwipeEnded/onZLSwipeCancelled. Old names are deprecated but still work.