https://github.com/orchetect/swift-textfile
Read & write delimited text file formats (incl. CSV and TSV).
https://github.com/orchetect/swift-textfile
csv csv-export csv-files csv-import csv-parser ios macos swift5 swift5-3 tsv tsv-files tsv-format tsv-parser tvos watchos
Last synced: 2 days ago
JSON representation
Read & write delimited text file formats (incl. CSV and TSV).
- Host: GitHub
- URL: https://github.com/orchetect/swift-textfile
- Owner: orchetect
- License: mit
- Created: 2020-09-23T19:01:10.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2026-03-27T09:58:28.000Z (8 days ago)
- Last Synced: 2026-03-27T13:06:17.631Z (8 days ago)
- Topics: csv, csv-export, csv-files, csv-import, csv-parser, ios, macos, swift5, swift5-3, tsv, tsv-files, tsv-format, tsv-parser, tvos, watchos
- Language: Swift
- Homepage:
- Size: 152 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# swift-textfile
[](https://swiftpackageindex.com/orchetect/swift-textfile) [](https://swiftpackageindex.com/orchetect/swift-textfile) [](https://github.com/orchetect/swift-textfile/blob/main/LICENSE)
Read and write text files in Swift on Apple platforms and Linux.
- Support for text encoding detection
- Abstractions to read/write common delimited text file formats, including:
- CSV (comma-separated values)
- TSV (tab-separated values)
> [!NOTE]
>
> This library implements the full CSV and TSV specifications including proper escape sequences and text encoding auto-detection including handling of BOMs (byte order marks) to assure the widest compatibility. Limited support for reading malformed text encoding is implemented.
## Overview
The main types provided:
| Type | Description |
| --------------- | ------------------------------------------------------------ |
| `PlainTextFile` | Read text file content from disk or from data in memory, with modestly robust text encoding auto-detection. |
| `CSV` | Read and write CSV files. Reading implements the same text encoding auto-detection schema as `PlainTextFile`. |
| `TSV` | Read and write TSV files. Reading implements the same text encoding auto-detection schema as `PlainTextFile`. |
| `StringTable` | A basic abstraction for manipulating a matrix of strings (row and columns). |
## Installation
### Swift Package Manager (SPM)
To add this package to an Xcode app project, use:
`https://github.com/orchetect/swift-textfile` as the URL.
To add this package to a Swift package, add the dependency to your package and target in Package.swift:
```swift
let package = Package(
dependencies: [
.package(url: "https://github.com/orchetect/swift-textfile", from: "0.5.0")
],
targets: [
.target(
dependencies: [
.product(name: "TextFile", package: "swift-textfile")
]
)
]
)
```
## Roadmap
Future library additions could bring additional table data text file formats.
## Author
Coded by a bunch of 🐹 hamsters in a trench coat that calls itself [@orchetect](https://github.com/orchetect).
## License
Licensed under the MIT license. See [LICENSE](https://github.com/orchetect/swift-textfile/blob/master/LICENSE) for details.
## Community & Support
Please do not email maintainers for technical support. Several options are available for issues and questions:
- Questions and feature ideas can be posted to [Discussions](https://github.com/orchetect/swift-textfile/discussions).
- If an issue is a verifiable bug with reproducible steps it may be posted in [Issues](https://github.com/orchetect/swift-textfile/issues).
## Contributions
Contributions are welcome. Posting in [Discussions](https://github.com/orchetect/swift-textfile/discussions) first prior to new submitting PRs for features or modifications is encouraged.
## Legacy
This repository was formerly known as **swift-textfile-tools**, and previously **TextFileKit**.