Localization helper for iOS apps mainly focusing on the LTR/RTL issue
pod 'MOLH' to your podfile. (check https://cocoapods.org/ for more info about cocoapods)
You can install it through Swift package manager as well.
When you start the app
MOLH.shared.activate(false) to not use swizzling and use subclassing from MOLH* UI classes.
MOLH.setLanguageTo(MOLHLanguage.currentAppleLanguage() == "en" ? "ar" : "en") MOLH.reset()
Before .activate set
you can choose to not use swizzling
MOLH.shared.activate(false) , in that case you subclass MOLH-UI Subclasses , like
MOLHTextField , this will give you more controlability as you can by-pass the tag requirement by using
forceSwitchingRegardlessOfTag and set it to true.
To make sure an image is flipped when switching to RTL or to LTR, you can use
flipIfNeeded() function on image or
Its better to have the app fonts in one place in your app, e.g. a FontManager. and there you can decide which font to use based on the chosen language, this would be the eaiser way.
Some controls such as ActionSheetDatePicker have locale property so you can set them appropriately e.g.
actionSheetDatePicker?.locale = Locale(identifier: MOLHLanguage.currentLocaleIdentifier())
use this line to solve it
collectionView.semanticContentAttribute = .unspecified
Thanks to didats
you may check this post.
If you enjoy MOLH and I want to say thank you, you can (buy me a coffee)[https://www.buymeacoffee.com/moathothman]