8000 Implementations of `trailingToSuperview` and `leadingToSuperview` only work correct only for Left-to-Right languages / layout. · Issue #95 · roberthein/TinyConstraints · GitHub 10000
[go: up one dir, main page]

Skip to content

Implementations of trailingToSuperview and leadingToSuperview only work correct only for Left-to-Right languages / layout. #95

@therohansanap

Description

< 7A4A div class="ActivityHeader-module__activityHeader--WiwzD IssueBodyHeader-module__activityHeaderWrapper--WDoKj">
@therohansanap

What layout do I expect?

I want my signupButton to have it's trailing edge 20 points before safeAreaLayoutGuide.centerXAnchor. Similarly, I want my loginButton to have its leading edge 20 points after safeAreaLayoutGuide.centerXAnchor. Below image displays the layout in desired state:
LTR
Left-to-Right Layout 👆🏾
RTL-correct
Right-to-Left Layout 👆🏾

What does my code looks like?

let signupButton = UIButton(type: .system)
signupButton.setTitle("Signup", for: .normal)
view.addSubview(signupButton)
signupButton.bottomToSuperview(offset: -50)
signupButton.trailingToSuperview(view.safeAreaLayoutGuide.centerXAnchor, offset: 20)

let loginButton = UIButton(type: .system)
loginButton.setTitle("Login", for: .normal)
view.addSubview(loginButton)
loginButton.bottomToSuperview(offset: -50)
loginButton.leadingToSuperview(view.safeAreaLayoutGuide.centerXAnchor, offset: 20)

What output do I get with above code?

Below are the screenshots of my output:
LTR
Left-to-Right Layout 👆🏾
RTL-bug
Right-to-Left Layout 👆🏾

The problem

It looks like the way superview methods are implemented, they work correct only for Left-to-Right language / layout direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0