This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build the Swift package
swift build
# Build the development app (for testing features)
xcodebuild -project Development/Development.xcodeproj -scheme Development build# Run all tests
swift test
# Run tests using Xcode
xcodebuild test -project Development/Development.xcodeproj -scheme DevelopmentThis is a Swift Package providing UIKit-based collection view components with SwiftUI integration, organized into four main modules:
- DynamicListView: Core UIKit-based collection view with NSDiffableDataSource
- VersatileCell: Flexible cell implementation supporting SwiftUI content via hosting
- HostingConfiguration: Manages SwiftUI view hosting in UIKit cells
- Supports incremental content loading with
ContentPagingTrigger
- CollectionView: Pure SwiftUI implementation using UICollectionView under the hood
- SelectableForEach: Provides selection support (single/multiple)
- CollectionViewLayout: Configurable layouts (list, grid, compositional)
- Provides scroll position tracking functionality for SwiftUI views
- Implements sticky header behavior for scroll views
The library uses a cell provider pattern where cells are configured through closures:
list.setUp(
cellProvider: { context in
// context.cell returns a UICollectionViewCell hosting SwiftUI content
context.cell { state in
// SwiftUI view content
}
}
)Uses NSDiffableDataSourceSnapshot for efficient updates with custom extensions for safety:
NSDiffableDataSourceSnapshot+Unique.swiftprovides safe operations
- UIKit cells host SwiftUI views through
HostingConfiguration - Supports state preservation and updates
- Pre-rendering capabilities via swift-with-prerender dependency
- iOS 16+
- macOS 15+
- Swift 6.0 language mode
The Development/ directory contains a comprehensive example app demonstrating:
- Various collection view layouts
- Selection handling
- Performance testing
- Different implementation approaches