MetovaJSONCodable is a lightweight Codable protocol with addtional support for JSON
Requirements
- Swift 4.0
- iOS 9+
Installation
MetovaJSONCodable is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MetovaJSONCodable'
Usage
Any object that previously conformed to the Codable protocol can now use the JSONCodable protocol.
Object example
struct Token: JSONCodable {
var tokenID: Int
var email: String
var authenticationToken: String
}
JSON
let tokenJSON: JSON =
[
"testID": 1,
"email": "test@email.com",
"authenticationToken": "token"
]
let token = Token(from: tokenJSON)
Documentation
Documentation can be found here.
Credits
MetovaJSONCodable is owned and maintained by Metova Inc.
License
MetovaJSONCodable is available under the MIT license. See the LICENSE file for more info.
View on GitHub
MetovaJSONCodable Reference