You can't change segue names programmatically. Because a segue defines a transition between two view controllers in your app’s storyboard file and you can rename it in your storyboard.
You can define more than one segues between your view controllers and call segues programmatically like this:
performSegue(withIdentifier: "yourSegueID", sender: nil)
For your problem:
- You can create two segues between your view controllers, and give
two different segue identifier names to them (eg. englishSegue and
arabicSegue).
- Create a variable for your segue identifier. (You will use it to
select which of your segue should be triggered.)
- Control your language in your view controller (eg. in your
viewDidLoad function or where you should control it)
programmatically and set your language variable as English or Arabic.
After that you can trigger it anywhere you want it. For example in a
button click:
if (yourIdentifier == "English") {
performSegue(withIdentifier: "englishSegue", sender: nil)
} else if (yourIdentifier == "Arabic") {
performSegue(withIdentifier: "arabicSegue", sender: nil)
}