Latest 1.0.0
Homepage https://github.com/joalbright/Encodable
License MIT
Platforms ios 9.0, requires ARC
Dependencies Inlinit
Authors

Swiftly Encode & Decode for Archiving & JSON

Version
License
Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

struct Person: Encodable {

    var name: String?
    var age: Int = 0

    init() { }

    init(_ info: EncodedInfo) {

        name <-- info["name"]
        age <-- info["age"]

    }

}

Struct from Example project

struct Album: Encodable {

    var title: String?
    var artist: String?
    var albumImageURL: String?
    var albumImage: UIImage?
    var trackCount: Int?
    var collectionPrice: Double?

    init() { }

    init(_ info: EncodedInfo) {

        title <-- info["collectionName"]
        artist <-- info["artistName"]
        albumImageURL <-- info["artworkUrl100"]
        trackCount <-- info["trackCount"]
        collectionPrice <-- info["collectionPrice"]

    }

}

Requirements

This pod uses Inlinit (a pod that allows closure initalizers).

Installation

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

pod "Encodable"

Encodable is also available through Swift Package Manager. Please take a look at the link to learn more about how to use SwiftPM.

import PackageDescription

let package = Package(
    name: "YOUR_PACKAGE_NAME",
    dependencies: [
        .Package(url: "https://github.com/joalbright/Encodable.git", majorVersion: 0)
    ]
)

Author

Jo Albright

License

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

Latest podspec

{
    "name": "Encodable",
    "version": "1.0.0",
    "summary": "Swiftly Encode & Decode for Archiving & JSON",
    "description": "A simple way to convert properties into dictionary collections and backwards.",
    "homepage": "https://github.com/joalbright/Encodable",
    "license": "MIT",
    "authors": {
        "Jo Albright": "[email protected]"
    },
    "source": {
        "git": "https://github.com/joalbright/Encodable.git",
        "tag": "1.0.0"
    },
    "social_media_url": "https://twitter.com/joalbright",
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "Sources/*",
    "resource_bundles": {
        "Encodable": [
            "Pod/Assets/*.png"
        ]
    },
    "dependencies": {
        "Inlinit": [
            "~> 0.1"
        ]
    }
}

Pin It on Pinterest

Share This