{"id":21965438,"url":"https://github.com/hitendradeveloper/collectionstack-swiftui","last_synced_at":"2026-05-07T07:34:21.756Z","repository":{"id":240724180,"uuid":"596318713","full_name":"hitendradeveloper/CollectionStack-SwiftUI","owner":"hitendradeveloper","description":"CollectionStack is designed to solve limitation of HStack and VStack in SwiftUI, it grows horizontally first, then vertically if next element could not fit horizontally.","archived":false,"fork":false,"pushed_at":"2023-02-01T23:26:40.000Z","size":45,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-28T01:22:02.789Z","etag":null,"topics":["collectionstack","hstack","swift","swift-package-manager","swiftui","vstack"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hitendradeveloper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-01T23:21:09.000Z","updated_at":"2023-04-07T18:12:13.000Z","dependencies_parsed_at":"2024-05-20T18:24:10.645Z","dependency_job_id":null,"html_url":"https://github.com/hitendradeveloper/CollectionStack-SwiftUI","commit_stats":null,"previous_names":["hitendradeveloper/collectionstack-swiftui"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hitendradeveloper%2FCollectionStack-SwiftUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hitendradeveloper%2FCollectionStack-SwiftUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hitendradeveloper%2FCollectionStack-SwiftUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hitendradeveloper%2FCollectionStack-SwiftUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hitendradeveloper","download_url":"https://codeload.github.com/hitendradeveloper/CollectionStack-SwiftUI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245022166,"owners_count":20548494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collectionstack","hstack","swift","swift-package-manager","swiftui","vstack"],"created_at":"2024-11-29T12:40:29.334Z","updated_at":"2026-05-07T07:34:21.728Z","avatar_url":"https://github.com/hitendradeveloper.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CollectionStack-SwiftUI\n\n**CollectionStack is designed to solve limitation of HStack and VStack in SwiftU, it grows horizontally first, then vertically if next element could not fit horizontally.** \n\n## How to use in code?\n\n```swift\nstruct App: Identifiable {\n\tvar name: String\n\tvar id: String { return name }\n}\n\nlet apps: [App] = [\n\t\"youtube\", \"podcast\", \"twitter\",\n\t\"facebook\", \"instagram\",\n\t\"free form\", \"github desktop\", \"source tree\"\n].map(App.init(name: ))\n\t\t\t\t\n//you can wrap this CollectionStack into ScrollView as well if you want scrolling\t\t\t\t\nCollectionStack(apps) { app in\n\tButton {\n\t\tprint(\"Selected tag := \\(app.name)\")\n\t} label: {\n\t\tText(app.name)\n\t\t\t.font(.system(.callout, design: .rounded, weight: .regular))\n\t}\n\t.buttonStyle(.bordered)\n\t.padding(.trailing, 8)\n\t.padding(.bottom, 8)\n}\n```\n\n## Output of above sample code\n[![Example output](https://github.com/hitendradeveloper/CollectionStack-SwiftUI/raw/main/info-assets/CollectionStack-output.png)](https://github.com/hitendradeveloper/CollectionStack-SwiftUI/raw/main/info-assets/CollectionStack-output.png)\n\n\n## CollectionStack\n\u003e is generic SwiftUI View over data and content\n\n## Data\n\u003e The collection of underlying identified data that CollectionStack uses to create views dynamically.\n\n## Content\n\u003e A function to create content on demand using the underlying data. It's a mapper function which maps Data to some View.\n\n## Public API is consistent same as ForEach of SwiftUI\n```swift\n/// Creates an instance that uniquely identifies and creates views across\n/// updates based on the identity of the underlying data.\n///\n/// It's important that the `id` of a data element doesn't change unless you\n/// replace the data element with a new data element that has a new\n/// identity. If the `id` of a data element changes, the content view\n/// generated from that data element loses any current state and animations.\n///\n/// - Parameters:\n///   - data: The identified data that the ``CollectionStack`` instance uses to\n///     create views dynamically.\n///   - content: The view builder that creates views dynamically.\n\npublic init(_ data: Data, @ViewBuilder content: @escaping (Data.Element) -\u003e Content)\n```\n\n## Requirements\n\n| Platform | Minimum Swift Version | Installation | Status |\n| --- | --- | --- | --- |\n| iOS 13.0+ | 5.0 | [Swift Package Manager](#swift-package-manager), [Manual](#manually) | Fully Tested |\n| macOS 10.15+ | 5.0 | [Swift Package Manager](#swift-package-manager), [Manual](#manually) | Fully Tested |\n| tvOS 13.0+ | 5.0 | [Swift Package Manager](#swift-package-manager), [Manual](#manually) | Fully Tested |\n| watchOS 6.0+ | 5.0 | [Swift Package Manager](#swift-package-manager), [Manual](#manually) | Fully Tested |\n\n### Swift Package Manager\n\nThe  [Swift Package Manager](https://swift.org/package-manager/)  is a tool for automating the distribution of Swift code and is integrated into the  `swift`  compiler.\n\nOnce you have your Swift package set up, adding CollectionStack-SwiftUI as a dependency is as easy as adding it to the  `dependencies`  value of your  `Package.swift`.\n\n```\ndependencies: [\n    .package(url: \"https://github.com/hitendradeveloper/CollectionStack-SwiftUI.git\", .upToNextMajor(from: \"1.0.0\"))\n]\n```\n\n## License\n\nCollectionStack-SwiftUI is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhitendradeveloper%2Fcollectionstack-swiftui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhitendradeveloper%2Fcollectionstack-swiftui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhitendradeveloper%2Fcollectionstack-swiftui/lists"}