Last active
October 2, 2016 00:55
-
-
Save YuiChiLo/03ce2917e94b81868fb5934811fd341a to your computer and use it in GitHub Desktop.
Playground上で端末ロケールを変更する
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
// MARK: - 端末のロケール設定 | |
extension NSLocale { | |
class func customLocale() -> NSLocale { | |
return NSLocale(localeIdentifier: "ja") | |
} | |
} | |
let methodLocale = class_getClassMethod(NSLocale.self, #selector(getter: NSLocale.current)) | |
let swizzledMethodLocale = class_getClassMethod(NSLocale.self, #selector(NSLocale.customLocale)) | |
method_exchangeImplementations(methodLocale, swizzledMethodLocale) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment