Skip to content

Instantly share code, notes, and snippets.

View quangDecember's full-sized avatar
💭
my new year resolution is to not force unwrapped optionals

Quang quangDecember

💭
my new year resolution is to not force unwrapped optionals
View GitHub Profile
@quangDecember
quangDecember / KeyboardTableView.swift
Created January 11, 2019 14:36 — forked from douglashill/KeyboardTableView.swift
A UITableView that allows navigation and selection using a hardware keyboard.
// Douglas Hill, December 2018
import UIKit
/// A table view that allows navigation and selection using a hardware keyboard.
/// Only supports a single section.
class KeyboardTableView: UITableView {
// These properties may be set or overridden to provide discoverability titles for key commands.
var selectAboveDiscoverabilityTitle: String?
var selectBelowDiscoverabilityTitle: String?
@quangDecember
quangDecember / WebCacheCleaner.swift
Created December 27, 2018 10:00 — forked from insidegui/WebCacheCleaner.swift
Clear WKWebView's cookies and website data storage, very useful during development.
import Foundation
import WebKit
final class WebCacheCleaner {
class func clean() {
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
print("[WebCacheCleaner] All cookies deleted")
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in