Posted at

UserDefaultsでremoveAllできるようにする

More than 1 year has passed since last update.

ExtensionにremoveAllを追加

extension UserDefaults {

func removeAll() {
dictionaryRepresentation().forEach{ removeObject(forKey: $0.key) }
}
}

↓こんな感じで全部消せる

UserDefaults.standard.removeAll()