A Swift library for parsing and encoding INI configuration files.
Add to your Package.swift:
dependencies: [
.package(url: "https://github.com/nathanborror/swift-ini-generated.git", from: "1.0.0")
]import INI
let config = """
app_name = My Application
[database]
host = localhost
port = 5432
"""
// Decode
let ini = try INI(string: config)
print(ini.global["app_name"]) // "My Application"
print(ini["database", "host"]) // "localhost"
// Encode
var ini = INI()
ini.global["app_name"] = "My Application"
ini["database", "host"] = "localhost"
let encoded = ini.encode()- Global and named sections
- Array sections (lists without key=value pairs)
- Section prefix matching (for git-style configs)
- Quoted values with escape sequences
- Configurable encoder/decoder options
- Thread-safe (
Sendable)
- Swift 6.2+
- iOS 18+ / macOS 15+
See the tests for detailed usage examples covering all features.
MIT