Skip to content

Commit

Permalink
Fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
marmelroy committed Aug 27, 2016
1 parent 1478371 commit 170db30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/LanguageSwitch/Sample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: Any]?) -> Bool {
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
8 changes: 4 additions & 4 deletions examples/LanguageSwitch/Sample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ViewController: UIViewController {
// Add an observer for LCLLanguageChangeNotification on viewWillAppear. This is posted whenever a language changes and allows the viewcontroller to make the necessary UI updated. Very useful for places in your app when a language change might happen.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
NotificationCenter.defaultCenter().addObserver(self, selector: "setText", name: LCLLanguageChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(setText), name: NSNotification.Name(rawValue: LCLLanguageChangeNotification), object: nil)
}

// Remove the LCLLanguageChangeNotification on viewWillDisappear
Expand All @@ -42,8 +42,8 @@ class ViewController: UIViewController {

func setText(){
textLabel.text = "Hello world".localized();
changeButton.setTitle("Change".localized(), for: UIControlState.Normal)
resetButton.setTitle("Reset".localized(), for: UIControlState.Normal)
changeButton.setTitle("Change".localized(), for: UIControlState.normal)
resetButton.setTitle("Reset".localized(), for: UIControlState.normal)
}

// MARK: IBActions
Expand All @@ -52,7 +52,7 @@ class ViewController: UIViewController {
actionSheet = UIAlertController(title: nil, message: "Switch Language", preferredStyle: UIAlertControllerStyle.actionSheet)
for language in availableLanguages {
let displayName = Localize.displayNameForLanguage(language)
let languageAction = UIAlertAction(title: displayName, style: .Default, handler: {
let languageAction = UIAlertAction(title: displayName, style: .default, handler: {
(alert: UIAlertAction!) -> Void in
Localize.setCurrentLanguage(language)
})
Expand Down

0 comments on commit 170db30

Please sign in to comment.