Skip to content

Instantly share code, notes, and snippets.

View yaslab's full-sized avatar

Yasuhiro Hatta yaslab

  • Osaka, Japan
  • 03:25 (UTC +09:00)
View GitHub Profile
import Foundation
// -----------------------------------------------------------------------------
// Protocol
protocol UserDefaultsVariableProtocol {
associatedtype Value
var key: String { get }
import Foundation
extension UserDefaults {
struct Key<Value> {
let name: String
init(_ name: String) {
self.name = name
}
}
subscript<V: Codable>(key: Key<V>) -> V? {