BeyovaJSON 0.0.7

BeyovaJSON 0.0.7

Maintained by Canius Chu.



  • By
  • canius

BeyovaJSON

Travis CI Carthage Compatible CocoaPods Swift

BeyovaJSON allows any json for Coadable in Swift 4.

Installation

CocoaPods

pod 'BeyovaJSON'

Carthage

github "Beyova/BeyovaJSON"

Usage

import BeyovaJSON

Codable

Codable is added with Xcode 9, iOS 11 and Swift 4. It is used to make your data types encodable and decodable for compatibility with external representations such as JSON.

class Group: Codable {
	var title: String = "Guardians of the Galaxy"
	var members: JSON = [["name": "Star-Lord"],["name": "Groot"],["name": "Rocket"]]
	var date: Date = Date()
}
let group = Group()
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let data = try! encoder.encode(group)
print(String(bytes: data, encoding: .utf8)!)