Swiftpack.co - MoathOthman/MOLH as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by MoathOthman.
MoathOthman/MOLH v1.4.3
Localization helper for iOS apps mainly focusing on the LTR/RTL issue
⭐️ 106
🕓 7 weeks ago
.package(url: "https://github.com/MoathOthman/MOLH.git", from: "v1.4.3")


Localization helper for iOS apps mainly focusing on the LTR/RTL issue


Add pod 'MOLH' to your podfile. (check https://cocoapods.org/ for more info about cocoapods)

You can install it through Swift package manager as well.

How To Use

import MOLH


When you start the app


Make sure this method is called only once and not on every reset


MOLH.shared.activate(false) to not use swizzling and use subclassing from MOLH* UI classes.

To reset the language

MOLH.setLanguageTo(MOLHLanguage.currentAppleLanguage() == "en" ? "ar" : "en")

Set default

Before .activate set


using without swizzling (prefered)

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 UIImage().imageFlippedForRightToLeftLayoutDirection()


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.

Other Frameworks and bundles

Some controls such as ActionSheetDatePicker have locale property so you can set them appropriately e.g.

actionSheetDatePicker?.locale = Locale(identifier: MOLHLanguage.currentLocaleIdentifier())

Common Issues

Collection view content are flipped in a non readable way

use this line to solve it collectionView.semanticContentAttribute = .unspecified Thanks to didats

you may check this post.

uilabel/uitextfield are not reflecting

make sure to set the tag and make sure the .activate method is only called once and not on every reset


Support the library

If you enjoy MOLH and I want to say thank you, you can (buy me a coffee)[https://www.buymeacoffee.com/moathothman]


Stars: 106
Last commit: 7 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

General fixes
1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics