iosswiftcocoapodsswift4swrevealviewcontroller

How to change SWReaveal side menu form left to right when change language from (English to Arabic)


i'm trying to translate application from English to Arabic so i go to info in application and add Arabic , this add to file with storyboard when i change on it, it's appear right in application but the problem the side menu not open from right so any help
and this is my code for side menu

@IBOutlet weak var menuButton: UIBarButtonItem!
 override func viewDidLoad() {
        super.viewDidLoad()
          menuButton.target = self.revealViewController()
        menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
        self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
        self.view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())
}

i need help to let side menu appear from right when language Arabic and left when language English


Solution

  • Here is Working Code

    @IBOutlet weak var menuButton: UIBarButtonItem!
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
    
        // Here menuViewController is SideDrawer ViewCOntroller
        if let sidemenuViewController = storyboard.instantiateViewController(withIdentifier: "menuViewController") as? menuViewController{
            revealViewController().rightViewController = sidemenuViewController
            menuButton.target = self.revealViewController()
            self.revealViewController().rightViewRevealWidth = self.view.frame.width * 0.8
            menuButton.action = #selector(SWRevealViewController.rightRevealToggle(_:))
        }
    }
    

    By Storyboard you can this