{"id":25448096,"url":"https://github.com/krishkumar/flowlayout","last_synced_at":"2025-05-16T07:09:13.443Z","repository":{"id":277231211,"uuid":"931759353","full_name":"krishkumar/FlowLayout","owner":"krishkumar","description":"A flexible flow layout SwiftUI library","archived":false,"fork":false,"pushed_at":"2025-02-12T20:13:02.000Z","size":108,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T07:09:13.340Z","etag":null,"topics":["flexible-layout","flowlayout","hstack","ios","swift","swift-package-manager","swiftui"],"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/krishkumar.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":"2025-02-12T20:07:51.000Z","updated_at":"2025-03-22T19:05:14.000Z","dependencies_parsed_at":"2025-02-14T11:32:21.979Z","dependency_job_id":null,"html_url":"https://github.com/krishkumar/FlowLayout","commit_stats":null,"previous_names":["krishkumar/flowlayout"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishkumar%2FFlowLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishkumar%2FFlowLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishkumar%2FFlowLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishkumar%2FFlowLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krishkumar","download_url":"https://codeload.github.com/krishkumar/FlowLayout/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485048,"owners_count":22078767,"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":["flexible-layout","flowlayout","hstack","ios","swift","swift-package-manager","swiftui"],"created_at":"2025-02-17T19:18:47.965Z","updated_at":"2025-05-16T07:09:13.418Z","avatar_url":"https://github.com/krishkumar.png","language":"Swift","readme":"# FlowLayout\n\n![FlowLayout Diagram](flowlayout.jpg)\n\nA Swift library that provides a flexible flow layout. Arrange SwiftUI subviews in a \"flow\" style, wrapping items to the next line when necessary — similar to how text is arranged in a paragraph.\n\n## Features\n\n- **Dynamic Wrapping**: Subviews automatically wrap to a new row when there’s no more room in the current row.\n- **Alignment Options**: Supports different SwiftUI alignment options like leading, trailing, center, top, and bottom alignment.\n- **Adjustable Spacing**: Configurable horizontal and vertical spacing between subviews.\n- **Fit Content**: Optionally fit the layout’s width to the total width of the subviews, or use the parent's width as proposed by SwiftUI.\n\n## Usage\n\n1. Add FlowLayout as a dependency in your Swift Package Manager project:\n\n   ```swift\n   .package(\n       name: \"FlowLayout\",\n       url: \"https://github.com/krishkumar/FlowLayout.git\",\n       .upToNextMajor(from: \"1.0.0\")\n   )\n   ```\n\n2. Import the `FlowLayout` module in your Swift code:\n\n   ```swift\n   import FlowLayout\n   ```\n\n3. Use `FlowLayout` in your SwiftUI code:\n\n   ```swift\n    struct ContentView: View {\n    \t@State var allCities = [\"Dallas\", \"Austin\", \"New York\", \"Singapore\", \"London\", \"Houston\", \"Washington DC\", \"San Francisco\"]\n    \tvar body: some View {\n    \t\tHStack {\n    \t\t\tFlowLayout {\n    \t\t\t\tForEach(allCities, id: \\.self) { city in\n    \t\t\t\t\tText(\"\\(city)\")\n    \t\t\t\t\t\t.padding()\n    \t\t\t\t\t\t.background(Capsule().fill(.blue))\n    \t\t\t\t}\n    \t\t\t}\n    \t\t}\n    \t}\n\t}\n    ```\n\n## Contributing\n\nContributions are welcome! Feel free to open issues and submit pull requests.\n\n## Implementation\n\nFlowLayout uses SwiftUI’s PreferenceKeys to measure child views, making it easier to adapt dynamically to changes in content size. Combined with SwiftUI’s Layout protocol — flexibly arrange subviews that automatically reflows as needed.\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrishkumar%2Fflowlayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrishkumar%2Fflowlayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrishkumar%2Fflowlayout/lists"}