Skip to content

Instantly share code, notes, and snippets.

View hellensoloviy's full-sized avatar

Hellen S. hellensoloviy

  • Kyiv
View GitHub Profile
import Foundation
protocol JSONDecodable {
func jsonParams() throws -> [String : Any]
}
extension JSONDecodable where Self : Codable {
func jsonParams() throws -> [String : Any] {
let encoder = JSONEncoder()
let data = try encoder.encode(self)