rtl iOS swift

func switchViewControllers(isArabic arabic : Bool){

        if arabic {
            UIView.appearance().semanticContentAttribute = arabic ? .forceRightToLeft : .forceLeftToRight
            let appDelegate = UIApplication.shared.delegate as? AppDelegate
            let homeViewController = HomeViewController()
            appDelegate?.window?.rootViewController = homeViewController
         }
}
Mobile Star