Skip to content
Snippets Groups Projects

Update Bindings

Merged Dariusz Rybicki requested to merge feature/update-bindings into development
2 files
+ 69
0
Compare changes
  • Side-by-side
  • Inline
Files
2
 
import Foundation
 
public struct Fact: Equatable {
public struct Fact: Equatable {
public init(
public init(
fact: String,
fact: String,
@@ -16,4 +18,22 @@ extension Fact: Codable {
@@ -16,4 +18,22 @@ extension Fact: Codable {
case fact = "Fact"
case fact = "Fact"
case type = "Type"
case type = "Type"
}
}
 
 
static func decode(_ data: Data) throws -> Fact {
 
try JSONDecoder().decode(Self.self, from: data)
 
}
 
 
func encode() throws -> Data {
 
try JSONEncoder().encode(self)
 
}
 
}
 
 
extension Array where Element == Fact {
 
static func decode(_ data: Data) throws -> [Fact] {
 
try JSONDecoder().decode(Self.self, from: data)
 
}
 
 
func encode() throws -> Data {
 
try JSONEncoder().encode(self)
 
}
}
}
Loading