Skip to content

Add ForEach view for iterating over collections#213

Merged
jverkoey merged 1 commit into
ClutchEngineering:mainfrom
21-DOT-DEV:FOREACH
Sep 30, 2025
Merged

Add ForEach view for iterating over collections#213
jverkoey merged 1 commit into
ClutchEngineering:mainfrom
21-DOT-DEV:FOREACH

Conversation

@csjones

@csjones csjones commented Aug 26, 2025

Copy link
Copy Markdown
Contributor

⚡ Summary

This PR introduces a new ForEachView component to Slipstream, enabling iteration over collections to dynamically render repeated content. It is inspired by SwiftUI’s ForEach, but tailored for Slipstream’s ViewBuilder system. For example:

ForEach(articles, id: \.id) { article in
    ArticleView(article: article)
}

The implementation provides type safety through generics and RandomAccessCollection constraints, and streamlines the rendering of list-based UI components by supporting both Identifiable elements and explicit id key paths.

Unit tests cover:
• Iteration with Identifiable collections
• Iteration with custom id key paths
• Rendering links and styled elements via modifiers
• Handling empty collections with explicit fallback content

☑️ Checklist

  • Checked locally
  • Add tests
  • Add documentation

@jverkoey jverkoey merged commit ad7c12f into ClutchEngineering:main Sep 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants