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) |
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 UIKit | |
extension UIViewController { | |
func getForegroundAlertController() -> UIAlertController? { | |
var viewController = UIApplication.sharedApplication().keyWindow?.rootViewController | |
while let controller = viewController?.presentedViewController { | |
if controller is UIAlertController { | |
viewController = controller |
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 UIKit | |
/// Syntax Swift 2.2 | |
extension UIAlertController { | |
class func showIndicatorAlert(viewController: UIViewController, message: String) { | |
let alert: UIAlertController = self.init(title: nil, message: message, preferredStyle: .Alert) | |