{"id":16234130,"url":"https://github.com/zackify/swift-csv","last_synced_at":"2025-06-27T20:36:24.409Z","repository":{"id":72855832,"uuid":"246159970","full_name":"zackify/swift-csv","owner":"zackify","description":"A CSV Generator for Swift","archived":false,"fork":false,"pushed_at":"2024-03-14T19:07:17.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T07:43:04.316Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zackify.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}},"created_at":"2020-03-09T23:02:48.000Z","updated_at":"2024-02-14T19:42:16.000Z","dependencies_parsed_at":"2024-03-14T20:28:05.234Z","dependency_job_id":"06d43cee-afdd-4f41-8018-3b201a410cfc","html_url":"https://github.com/zackify/swift-csv","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/zackify/swift-csv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackify%2Fswift-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackify%2Fswift-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackify%2Fswift-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackify%2Fswift-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zackify","download_url":"https://codeload.github.com/zackify/swift-csv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackify%2Fswift-csv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262329452,"owners_count":23294693,"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":[],"created_at":"2024-10-10T13:15:06.408Z","updated_at":"2025-06-27T20:36:24.379Z","avatar_url":"https://github.com/zackify.png","language":"Swift","readme":"# swift-csv\n\n## Install\n\nAdd to your Package.swift dependencies:\n\n```\n.package(url: \"https://github.com/zackify/swift-csv.git\", from: \"0.2.0\")\n```\n\n## Example\n\nGenerate CSVs with dynamic column headings and row data.\n\nIf you have a data structure with unknown amount of values, it can be frustrating to make that fit into a CSV. For example, imagine a CSV with people, and an unknown number of addresses. With this library, you can return an array, and column headings will be calculated for you:\n\n```swift\nimport SwiftCSV\n\nlet csv = SwiftCSV.generate(testRows) {\n    [\n        $0.text(name: \"Name\", value: $0.row.name),\n        $0.array(name: \"Address\", value: $0.row.addresses) { $0.street },\n        $0.text(name: \"Phone number\", value: $0.row.phoneNumber)\n    ]\n}\n```\n\nHere's the output:\n\n```\n\"Name\",\"Address\",\"Address #2\",\"Address #3\",\"Phone number\"\n\"Test\",\"New York\",\"California\",\"\",\"5493939393\"\n\"Bob\",\"Montana\",\"California\",\"Texas\",\"483884828\"\n```\n\nBy naming the field `Address` the headings and rows fill in with empty data where needed.\n\nIn the example, testRows looks like this:\n\n```swift\nstruct Address {\n  var street: String\n}\n\nstruct Person {\n  var id: String\n  var name: String\n  var phoneNumber: String\n  var addresses: [Address]\n}\n\nlet testRows = [\n  Person(\n    id: \"1\",\n    name: \"Test\",\n    phoneNumber: \"5493939393\",\n    addresses: [\n      Address(street: \"New York\"),\n      Address(street: \"California\"),\n    ]\n  ),\n  Person(\n    id: \"1\",\n    name: \"Bob\",\n    phoneNumber: \"483884828\",\n    addresses: [\n      Address(street: \"Montana\"),\n      Address(street: \"California\"),\n      Address(street: \"Texas\"),\n    ]\n  )\n]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzackify%2Fswift-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzackify%2Fswift-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzackify%2Fswift-csv/lists"}