Latest 0.1.8
Homepage https://github.com/pourhadi/SuperSerial
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

Usage

SuperSerial uses Swift’s Mirror to automatically infer a struct’s stored variables, allowing for hassle-free out-of-the-box JSON serialization. Conforming that struct to AutoSerializable allows for easy deserialization as well.

Also supports custom serialization for structs and object types.

See header comments for more details.

struct Person {
    let name:String
    let age:Int
}

extension Person:AutoSerializable {
    init?(withValuesForKeys: [String : Serializable]) {
        self.name = withValuesForKeys["name"] as! String
        self.age = withValuesForKeys["age"] as! Int
    }
}

let people:[Serializable] = [Person(name: "Bob", age: 30), Person(name: "Lisa", age: 32), Person(name: "Mark", age: 29)]

Specify the types that can be serialized and deserialized:

SuperSerial.serializableTypes = [Person.self]

Serialize and deserialize:

let serialized = Serialized(fromArray: people)
let jsonString = serialized.toString()
let fromString = Serialized(serializedString: jsonString)
let deserialized = fromString?.deserialize()

Requirements

Installation

SuperSerial is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SuperSerial"

Author

Daniel Pourhadi, [email protected]

License

SuperSerial is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SuperSerial",
    "version": "0.1.8",
    "summary": "JSON serialization/deserialization for Swift object & value types, with automatic stored-property inferrance in structs.",
    "description": "JSON serialization/deserialization for Swift value types (structs in particular) and objects, with automatic stored-property inferrance using Swift Mirror.",
    "homepage": "https://github.com/pourhadi/SuperSerial",
    "license": "MIT",
    "authors": {
        "Daniel Pourhadi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/pourhadi/SuperSerial.git",
        "tag": "0.1.8"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "documentation_url": "http://pourhadi.github.io/SuperSerialDocumentation/",
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "SuperSerial": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This