TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jan 2016 |
SPMSupports SPM | ✓ |
Maintained by Jo Albright.
Swiftly Encode & Decode for Archiving & JSON
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"]
}
}
This pod uses Inlinit (a pod that allows closure initalizers).
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)
]
)
Encodable is available under the MIT license. See the LICENSE file for more info.