Latest 0.8.5
Homepage https://github.com/gzkiwiinc/SuperCodable
License MIT
Platforms ios 8.0, requires ARC
Authors

Install

pod 'SuperCodable'

Rx: Variable decode support

If you want to decode value to Variable, install:

pod 'SuperCodable/Rx'

Usage

extension Int: DecodeFailable {
    public static var decodeFailedValue: Int { return 0 }
}

struct VariableModel: Codable {
    let code: Variable<Int>
    var stringValue: Variable<String?>
}

If you declare a Variable type property, we assume you don’t want a optional Variable. Instead of optional property, you’d like to change it to optional Element. If Element is Optional, it will work as you wish. If Variable inner Element is not Optional, you should confrom Element type to DecodeFailable. Once Variable property decode failed, it will use DecodeFailable.decodeFailedValue to init Variable.

Inspired by

Latest podspec

{
    "name": "SuperCodable",
    "version": "0.8.5",
    "summary": "give Codable super power",
    "description": "give Codable super power.",
    "homepage": "https://github.com/gzkiwiinc/SuperCodable",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "lacklock": "[email protected]"
    },
    "swift_version": "4.2",
    "source": {
        "git": "https://github.com/gzkiwiinc/SuperCodable.git",
        "tag": "0.8.5"
    },
    "source_files": "SuperCodable/*.swift",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "default_subspecs": "Codable",
    "subspecs": [
        {
            "name": "Codable",
            "source_files": "SuperCodable/*.swift"
        },
        {
            "name": "Rx",
            "source_files": "SuperCodable/Rx/*.swift",
            "dependencies": {
                "RxSwift": [
                    "~> 4.0"
                ]
            }
        },
        {
            "name": "RealmCache",
            "source_files": "SuperCodable/Realm/*.swift",
            "platforms": {
                "ios": "8.0"
            },
            "dependencies": {
                "RealmSwift": [],
                "SuperCodable/Codable": []
            }
        }
    ]
}

Pin It on Pinterest

Share This