Skip to content

Instantly share code, notes, and snippets.

@moveitonover
Last active October 27, 2020 13:51
Show Gist options
  • Save moveitonover/0841b4ae116aab39ddde92a1c4892ea8 to your computer and use it in GitHub Desktop.
Save moveitonover/0841b4ae116aab39ddde92a1c4892ea8 to your computer and use it in GitHub Desktop.
Localized strings accessible from com.apple.UIKit bundle
//
// UIKitLocalizedString.swift
//
// Helper class for accessing the localized strings shipped with Apple UIKit
//
class UIKitLocalizedString {
static let bundle = Bundle(identifier: "com.apple.UIKit")
class var ok: String {
return localizedStringForKey("Ok")
}
class var search: String {
return localizedStringForKey("Search")
}
class var cancel: String {
return localizedStringForKey("Cancel")
}
class var done: String {
return localizedStringForKey("Done")
}
static func localizedStringForKey(_ key: String) -> String {
return bundle?.localizedString(forKey: key, value: key, table: nil) ?? key
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment