Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. iOS
  3. CSV.swift

CSV.swift

MITSwift2.5.2

A Swift library for reading and writing CSV files with support for Decodable serialization and RFC4180 compliance.

GitHubGitHub
726 stars85 forks0 contributors

What is CSV.swift?

CSV.swift is a Swift library for reading and writing CSV (Comma-Separated Values) files. It provides tools to parse CSV data from strings or files, serialize rows into Decodable objects, and generate CSV output, solving the problem of handling tabular data in Swift applications.

Target Audience

Swift developers working with CSV data in iOS, macOS, or server-side applications, particularly those needing type-safe parsing or integration with Swift's Codable system.

Value Proposition

Developers choose CSV.swift for its native Swift API, support for Decodable serialization, and adherence to RFC4180, offering a lightweight and idiomatic alternative to manual CSV handling or heavier data processing libraries.

Overview

CSV reading and writing library written in Swift.

Use Cases

Best For

  • Parsing CSV files in Swift command-line tools
  • Importing/exporting tabular data in iOS or macOS apps
  • Converting CSV rows to Swift Decodable structs
  • Generating CSV reports from Swift data structures
  • Handling CSV data with custom character encodings
  • Processing CSV files in server-side Swift projects

Not Ideal For

  • Applications processing multi-gigabyte CSV files with strict memory or performance requirements
  • Projects needing real-time CSV streaming or asynchronous parsing without blocking the main thread
  • Environments where CSV data uses non-standard formats (e.g., tab-separated values or custom escaping rules) beyond RFC4180
  • Cross-platform codebases requiring a single CSV library across Swift and other programming languages

Pros & Cons

Pros

Type-Safe Decodable Integration

Directly serialize CSV rows into Swift structs using Decodable protocol with CSVRowDecoder, as shown in the README example for converting rows to objects like DecodableExample.

Header-Based Field Access

Access fields intuitively via subscript notation with header names (e.g., csv["id"]!), reducing reliance on column indices and improving code readability.

RFC4180 Compliance

Adheres to the standard CSV format specification, ensuring reliable parsing and generation for interoperability with other systems and tools.

Flexible Input/Output Options

Supports reading from strings or file streams and writing to memory or files, with customizable character encodings like UTF16, as demonstrated in the code examples.

Cons

No Asynchronous Support

The library lacks built-in async/await or concurrent parsing features, which can limit performance for large file processing in modern Swift applications.

Error Handling Verbosity

Examples in the README use force-unwrapping (!) and require manual try-catch blocks, leading to potentially cumbersome error management in production code.

Limited Format Customization

Focused on RFC4180 compliance, it may not support non-standard delimiters or complex escaping rules, restricting flexibility for unconventional CSV variants.

Frequently Asked Questions

Quick Stats

Stars726
Forks85
Contributors0
Open Issues25
Last commit1 year ago
CreatedSince 2016

Tags

#data-serialization#swift-package-manager#file-io#csv#tabular-data#cocoapods#swift#swift-library#decodable#csv-parser

Built With

S
Swift

Included in

iOS51.7k
Auto-fetched 1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub