Q:

Detect right to left Language in Swift UITest

I am trying to setup my UITests for localisation. Especially for Arabic and any other Right to Left (RTL) language.
In my case I have a swipe(direction: SwipeDirection) function that takes a value of SwipeDirection (.up, .down, .left, .right).
If I now want to delete let's say a cell, I'd just do cell.swipe(.left) and my UITest would delete the cell. Since the UI is flipped on RTL languages this has to change to cell.swipe(.right). 
I could not find any way of detecting the current device language, nor it's UILayoutDirection.
I've tried to check for it like this already:
let isLeftToRight = UIView.userInterfaceLayoutDirection(for: UIView().semanticContentAttribute) == .leftToRight

and also 
let isLeftToRight = UIApplication.shared.userInterfaceLayoutDirection == .leftToRight

But both of them always returning true, no matter the language.
Are there any other ways of checking for the current UILayoutDirection I am not aware of?
Thank you!

A:

Not exactly that hard to find in the documentation
let locale = NSLocale.autoupdatingCurrent
let lang = locale.languageCode
let direction = NSLocale.characterDirection(forLanguage:lang!)

