Skip to content

Instantly share code, notes, and snippets.

View rwisner's full-sized avatar
👋
Hello World

Rob Wisner rwisner

👋
Hello World
  • Star Publishing
  • Tucson, AZ
View GitHub Profile
@rwisner
rwisner / Swift3JSONStructs.swift
Created August 22, 2017 16:23 — forked from stinger/Swift3JSONStructs.swift
Swift 3: JSON-serializable structs using protocols
//: # Swift 3: JSON-serializable structs using protocols
//: Most of the implementation is based on the code in [this blog post](http://codelle.com/blog/2016/5/an-easy-way-to-convert-swift-structs-to-json/)
import Foundation
//: ### Defining the protocols
protocol JSONRepresentable {
var JSONRepresentation: Any { get }
}
protocol JSONSerializable: JSONRepresentable {}