Skip to content

Instantly share code, notes, and snippets.

import UIKit
enum BackgroundingSource: String {
case lock = "lock", homeOrSwitch = "homeOrSwitch"
}
protocol BackgroundingSourceTrackerDelegate: class {
func backgroundingSourceTracker(_ backgroundingSourceTracker: BackgroundingSourceTracker, didTrackBackgroundingWith source: BackgroundingSource)
}
@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 {