Search code examples
iosswiftright-to-leftmultilingual

Right to left support instead of some views and it's sub views


I want to make my app Right to left when the language is RTL, I put this line in AppDelegate

    UIView.appearance().semanticContentAttribute = .forceRightToLeft

It worked, but I want forced some view's to be left to right in both languages I changed these view's semantic from Unspecified to Force Left-to-Right but it doesn't worked.

enter image description here

Can you recommend me to make it work properly


Solution

  • This

    UIView.appearance().semanticContentAttribute = .forceRightToLeft
    

    will force all leading/trailing constraints to be right-aligned , so if you want to exclude some views , then you need to make their constraints with left/right , and this by selecting the constraint and toggle it's respect language direction