Last active
April 3, 2018 05:07
-
-
Save jasonm23/b351e4f540ac99bdbef2ff31761f0707 to your computer and use it in GitHub Desktop.
String+Localized.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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