Skip to content
Snippets Groups Projects
Commit f5321cd6 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Make JSONEncoder & JSONDecoder internal

to avoid name collisions when using XXClient library
parent 85bd2d7e
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!53Custom JSONEncoder & JSONDecoder
import CustomDump import CustomDump
import Foundation import Foundation
public class JSONDecoder: Foundation.JSONDecoder { class JSONDecoder: Foundation.JSONDecoder {
public override init() { override init() {
super.init() super.init()
} }
public override func decode<T>(_ type: T.Type, from data: Data) throws -> T where T: Decodable { override func decode<T>(_ type: T.Type, from data: Data) throws -> T where T: Decodable {
do { do {
let data = convertNumberToString(in: data, at: "Value") let data = convertNumberToString(in: data, at: "Value")
return try super.decode(type, from: data) return try super.decode(type, from: data)
......
import CustomDump import CustomDump
import Foundation import Foundation
public class JSONEncoder: Foundation.JSONEncoder { class JSONEncoder: Foundation.JSONEncoder {
public override init() { override init() {
super.init() super.init()
} }
public override func encode<T>(_ value: T) throws -> Data where T: Encodable { override func encode<T>(_ value: T) throws -> Data where T: Encodable {
do { do {
var data = try super.encode(value) var data = try super.encode(value)
data = convertStringToNumber(in: data, at: "Value") data = convertStringToNumber(in: data, at: "Value")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment