Forcing RTL layout in iOS Apps

What if you’re developing an App that is only in Arabic, or Hebrew, or any other RTL language. And you don’t really want to develop it in English first, then localise the strings. Usually you’d have this problem for example:

Showing problems with RTL


This has 3 layout problems:

  1. The navigation back button is on the left.
  2. The TableView section title is on the left.
  3. The Main text label of the UITableViewCell is also on the left.

Well luckily, since iOS 9, Apple provided a way to control this programmatically quite simply. Just use the UIView and UINavigationBar properties semanticContentAttributeSo for example if I add the following 2 lines to my AppDelegate application didFinishLaunchingWithOptions:

UIView.appearance().semanticContentAttribute = .forceRightToLeft
UINavigationBar.appearance().semanticContentAttribute = .forceRightToLeft

And voila:

RTL problems fixed


This way you can just develop using a single storyboard and not worry about localisation if you don’t need it.

You can check out the documentation for semanticContentAttribute at 

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top
Social media & sharing icons powered by UltimatelySocial
%d bloggers like this: