Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jnordberg/swift-query-string-coder

Standards compliant query string encoder & decoder for Swift's Codable protocol
https://github.com/jnordberg/swift-query-string-coder

codable decoding encoding swift

Last synced: 22 days ago
JSON representation

Standards compliant query string encoder & decoder for Swift's Codable protocol

Awesome Lists containing this project

README

        

# swift-query-string-coder

Standards compliant query string encoder & decoder for the `Codable` protocol.

```swift

struct MyQuery: Codable {
let hello: String
let tags: [String]
let flag: Bool
}

let encoder = QueryStringEncoder()

let query = MyQuery(hello: "world™", tags: ["foo", "bar"], flag: true)

let result = try encoder.encode(query)

print(result) // hello=world%E2%84%A2&tags=foo&tags=bar&flag
```

TODO
- [x] Encoder
- [ ] Decoder