Skip to content

Instantly share code, notes, and snippets.

View speaktoalvin's full-sized avatar

Alvin speaktoalvin

View GitHub Profile
//
// ImageCache.swift
//
// Created by Alec O'Connor on 3/6/18.
// Copyright © 2018 Alec O'Connor. All rights reserved.
//
import UIKit
class ImageCache {
struct Hoge: Storagable {
let id: Int
let name: String
}
protocol Storagable: Codable {}
extension Storagable {
func save(key: String = "\(Self.self)", userDefaults: UserDefaults = .standard) throws {
let data = try JSONEncoder().encode(self)