Skip to content

Instantly share code, notes, and snippets.

@jasonm23
Last active April 3, 2018 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonm23/b351e4f540ac99bdbef2ff31761f0707 to your computer and use it in GitHub Desktop.
Save jasonm23/b351e4f540ac99bdbef2ff31761f0707 to your computer and use it in GitHub Desktop.
String+Localized.swift
import Foundation
extension String {
var localized : String {
set {}
get {
guard let localizedString = NSLocalizedString(self, comment: "") else {
fatalError("\(self) - not available as localized")
}
return NSLocalizedString(self, comment: "")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment