MoathOthman / MOLH

Localization helper for iOS apps mainly focusing on the LTR/RTL issue
MIT License
117 stars 36 forks source link

adding an option to change animation when changing language #30

Closed deya-eldeen closed 5 years ago

deya-eldeen commented 5 years ago

Hello, some people asked me to change the animation transition when switching language....

I managed to make it as easy as MOLH.resetWithCrossDissolve()

please make this a feature available for all :) , thanks.

the simplest way is to extend MOLH with a new reset function.... and call it MOLH.resetWithCrossDissolve() for example

extension MOLH {
    open class func resetWithCrossDissolve() {
        let transition = UIViewAnimationOptions.transitionCrossDissolve
        if let delegate = UIApplication.shared.delegate {
            if delegate is MOLHResetable {
                (delegate as!MOLHResetable).reset()
            }
            UIView.transition(with: ((delegate.window)!)!, duration: 0.5, options: transition, animations: {}) { (f) in
            }
        }
    }
}
MoathOthman commented 5 years ago

@deya-eldeen thanx for the suggestion , can you make a pull request for that?

deya-eldeen commented 5 years ago

pull request sent.