Swiftpack.co - Package - dduan/TOMLDecoder

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

dduan/TOMLDecoder

From TOML to Swift Codable types.

TOMLDecoder

Swift 5.3 & 5.3.1
Amazon Linux 2
CentOS 8
macOS 11.15
Ubuntu Bionic
Ubuntu Focal

TOML parser for your Swift Codables.

struct Team: Codable {
    struct Player: Codable {
        let id: String
        let health: Int
        let joinDate: Date
    }

    let players: [Player]
}

let team = try TOMLDecoder().decode(Team.self, from: tomlData)

TOMLDecoder has a relatively simple set of APIs. Learn more in the introduction.

Installation

With SwiftPM

.package(url: "https://github.com/dduan/TOMLDecoder", from: "0.2.1")

License

MIT. See LICENSE.md.

Github

link
Stars: 37
Last commit: 6 days ago

Releases

0.2.1 - 2021-01-18T07:34:08

  • Include a new type DeserializationError. It contains information regarding deserialization.
  • Improve error reporting. After encountering one error, the parser will disgard characters until new line, and attempt to parse another top-level expression. This is more determinastic compared to previous recovery attempts.
  • Add more specific errors regarding missing pices at closing position. For example, string missing closing quotes, or table missing closing bracket. These errors will cause the parser to report detailed error message.
  • Fix a bug where newline characters sometimes are considered valid as part of basic string content.