tristanhimmelman / ObjectMapper

Simple JSON Object mapping written in Swift
MIT License
9.16k stars 1.03k forks source link

Add transform class for Codable types #1018

Closed jvk75 closed 6 years ago

jvk75 commented 6 years ago

Enables Swift built in Codable types to be used with ObjectMapper.

Usage:

    required init(map: Map) throws {
        items   = try map.value("items", using: CodableTransform<CodableModel>())
    }

    func mapping(map: Map) {
        items   >>> (map["total"], CodableTransform<CodableModel>())
    }
tristanhimmelman commented 6 years ago

Would be happy to merge this, but can you please add a few simple tests so we can ensure its functionality moving forward?

jvk75 commented 6 years ago

Sounds good, will do :)

tristanhimmelman commented 6 years ago

Dont worry about the broken test, I fixed that in the master branch. Thanks for adding in the testing