Skip to content

Instantly share code, notes, and snippets.

@iAmrSalman
Created August 5, 2017 05:53
Show Gist options
  • Save iAmrSalman/a727a18b1e420153fd67a6402e44aa75 to your computer and use it in GitHub Desktop.
Save iAmrSalman/a727a18b1e420153fd67a6402e44aa75 to your computer and use it in GitHub Desktop.
[language direction] how can determine the current direction for each individual view
if #available(iOS 9.0, *) {
if UIView.userInterfaceLayoutDirection(
for: myView.semanticContentAttribute) == .rightToLeft {
// The view is shown in right-to-left mode right now.
}
} else {
// Use the previous technique
if UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft {
// The app is in right-to-left mode
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment