ishkawa / APIKit

Type-safe networking abstraction layer that associates request type with response type.
MIT License
2k stars 205 forks source link

ExpressibleByDictionaryLiteral for JSONBodyParameters #275

Closed 417-72KI closed 3 years ago

417-72KI commented 5 years ago

There are redundant codes for initializing JSONBodyParameters. I make it possible to initialize simply from Dictionary Literal.

Before

let object = ["foo": 1, "bar": 2, "baz": 3]
let parameters = JSONBodyParameters(JSONObject: object)

After

let parameters: JSONBodyParameters = ["foo": 1, "bar": 2, "baz": 3]

or

let parameters = ["foo": 1, "bar": 2, "baz": 3] as JSONBodyParameters