diff --git a/JSONCodable/JSONCodable.swift b/JSONCodable/JSONCodable.swift index 7aca03a..07860cd 100644 --- a/JSONCodable/JSONCodable.swift +++ b/JSONCodable/JSONCodable.swift @@ -6,10 +6,6 @@ // Copyright © 2015 matthewcheok. All rights reserved. // -// convenience protocol - -public protocol JSONCodable: JSONEncodable, JSONDecodable {} - // JSONCompatible - valid types in JSON public protocol JSONCompatible: JSONEncodable {} diff --git a/JSONCodableTests/ClassInheritance.swift b/JSONCodableTests/ClassInheritance.swift index 05d6f0f..ba42809 100644 --- a/JSONCodableTests/ClassInheritance.swift +++ b/JSONCodableTests/ClassInheritance.swift @@ -9,7 +9,7 @@ import Foundation import JSONCodable -class Parent : JSONCodable +class Parent : JSONEncodable, JSONDecodable { var parentProperty1:String = "parent1" var parentProperty2:String = "parent2" diff --git a/JSONCodableTests/Food.swift b/JSONCodableTests/Food.swift index 91a5084..cf19649 100644 --- a/JSONCodableTests/Food.swift +++ b/JSONCodableTests/Food.swift @@ -30,7 +30,7 @@ func ==(lhs: Food, rhs: Food) -> Bool { return lhs.name == rhs.name && lhs.cuisines == rhs.cuisines } -extension Food: JSONCodable { +extension Food: JSONEncodable, JSONDecodable { init(object: JSONObject) throws { let decoder = JSONDecoder(object: object) name = try decoder.decode("name") diff --git a/JSONCodableTests/Fruit.swift b/JSONCodableTests/Fruit.swift index dcda939..89e9fbd 100644 --- a/JSONCodableTests/Fruit.swift +++ b/JSONCodableTests/Fruit.swift @@ -22,7 +22,7 @@ func ==(lhs: Fruit, rhs: Fruit) -> Bool { return lhs.name == rhs.name && lhs.color == rhs.color } -extension Fruit: JSONCodable { +extension Fruit: JSONEncodable, JSONDecodable { init(object: JSONObject) throws { let decoder = JSONDecoder(object: object) name = try decoder.decode("name")