Abedalkareem / LanguageManager-iOS

A Language manager to handle changing app language without restarting the app. It supports iOS and tvOS.
MIT License
393 stars 66 forks source link

Changing language while on same view tree #56

Closed aviya-smila closed 3 years ago

aviya-smila commented 3 years ago

Hi, is there a way to translate the whole current view hierarchy? I mean in order to change language I need to dismiss all the views currently opened and start the app from scratch.

Thanks, Aviya.

Abedalkareem commented 3 years ago

You can create your controllers stack again by yourself.

    LanguageManager.shared.setLanguage(language: selectedLanguage)
    { title -> UIViewController in
      let controller1 = NavigationController(root: HomeViewController())
      let controller2 = NewsViewController()
      controller1.show(controller2)
      return controller1
    } animation: { view in
      view.transform = CGAffineTransform(scaleX: 2, y: 2)
      view.alpha = 0
    }