Skip to content

Instantly share code, notes, and snippets.

View Maxim-Kolmogorov's full-sized avatar
☺️
I love my job

Maxim Kolmogorov Maxim-Kolmogorov

☺️
I love my job
View GitHub Profile
@elmolm
elmolm / UserDefaultsAndStructsExtension.swift
Last active August 6, 2020 14:15
Save and load structs and struct arrays in UserDefaults
import Foundation
extension UserDefaults {
open func setStruct<T: Codable>(_ value: T?, forKey defaultName: String){
let data = try? JSONEncoder().encode(value)
set(data, forKey: defaultName)
}
open func structData<T>(_ type: T.Type, forKey defaultName: String) -> T? where T : Decodable {
guard let encodedData = data(forKey: defaultName) else {
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)