Skip to content

Instantly share code, notes, and snippets.

@andrewcampoli
andrewcampoli / Storage.swift
Last active April 4, 2018 17:15 — forked from saoudrizwan/Storage.swift
Helper class to easily store and retrieve Codable structs from/to disk. https://medium.com/@sdrzn/swift-4-codable-lets-make-things-even-easier-c793b6cf29e1
import Foundation
protocol Encoder {
func encode<Value>(_ value: Value) throws -> Data where Value : Encodable
}
extension JSONEncoder: Encoder {}
extension PropertyListEncoder: Encoder {}
protocol Decoder {