Swiftmessages: How to change position to RTL ?

Created on 20 Jan 2019  Â·  5Comments  Â·  Source: SwiftKickMobile/SwiftMessages

How to change position to RTL ?
I tried also changing my device language to Arabic
but still shown as LTR not RTL !

            let view = MessageView.viewFromNib(layout: .cardView)

          view.configureTheme(.error)  

        view.button?.setTitle("إغلاق", for: .normal)

            view.configureDropShadow()

        view.titleLabel?.text = "تنبية"
        view.bodyLabel?.text = """
        الرجاء التأكد من إتصال الانترنت
        لا يمكن الاتصال بالخادم !
        """

            view.layoutMarginAdditions = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)

            (view.backgroundView as? CornerRoundingView)?.cornerRadius = 10

            var config = SwiftMessages.Config()

            config.presentationStyle = .top

            config.presentationContext = .window(windowLevel: .statusBar)

             config.duration = .forever

            config.dimMode = .gray(interactive: true)

            config.preferredStatusBarStyle = .lightContent

            config.eventListeners.append() { event in
                if case .didHide = event { print("yep") }
            }

        view.buttonTapHandler = { _ in SwiftMessages.hide() }

            SwiftMessages.show(config: config, view: view)

Most helpful comment

SwiftMessages supports RTL. My guess is you haven't added Arabic localization to your app.

screen shot 2019-01-20 at 11 07 55 am

simulator screen shot - iphone xr - 2019-01-20 at 11 10 40

All 5 comments

You shouldn't do anything to support RTL if your app is using AutoLayout.
I'm using this library with Hebrew and it works without any problem.
May you attach some images of Arabic VS English so we'll be able to see the difference you're talking about?

SwiftMessages supports RTL. My guess is you haven't added Arabic localization to your app.

screen shot 2019-01-20 at 11 07 55 am

simulator screen shot - iphone xr - 2019-01-20 at 11 10 40

@wtmoose
Thank you
this fix the issue only when I change the Device Language to Arabic

a lot of users choose the English Language as a Device Language

and all my design depends on English

is there another way to only change Alert Position?

Google "UIView force RTL"

Google "UIView force RTL"

I did try this

let viewMessage = MessageView.viewFromNib(layout: .cardView)

    viewMessage.semanticContentAttribute = .forceRightToLeft

but the layout doesn't change

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrey-zelenin picture andrey-zelenin  Â·  4Comments

mergesort picture mergesort  Â·  5Comments

lixiang1994 picture lixiang1994  Â·  6Comments

lohenyumnam picture lohenyumnam  Â·  3Comments

alper picture alper  Â·  6Comments