Skip to content

Instantly share code, notes, and snippets.

View nurtugan's full-sized avatar
🏠
Working from home

Nurtugan Nuraly nurtugan

🏠
Working from home
View GitHub Profile
@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)
extension String {
var localized: String {
return NSLocalizedString(self, comment: "")
}
}
// Which allows for:
"Hello world".localized
var str = "Hello, playground"
let url = URL(string: "http://www.example.com?skey=a72bzy321bgf&id=123123")!
extension URL {
var queryItemsDict: [String: String] {
var dict = [String: String]()
guard let urlComponents = URLComponents(url: self, resolvingAgainstBaseURL: false), let queryItems = urlComponents.queryItems else { return dict }
for queryItem in queryItems {
dict[queryItem.name] = queryItem.value ?? ""
}