freshOS / Stevia

:leaves: Concise Autolayout code

Home Page:https://freshos.github.io/SteviaDocs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue of leading(%) trailing (%) in 4.7.0 RTL support

mineschan opened this issue · comments

Firstly, thanks @s4cha a lot for the work on RTL support in 4.7.0
Able to use chainable api and visual formatting (|-10-label-|) in the RTL project I'm working on now!

However the leading trailing with SteviaPercentage is not working properly.
This also happened when I try to support it in my fork.

Hey @mineschan thank you so much for reporting this. Indeed the percent-based api is wrong with leading & trailing attributes at the moment. Turns out using multipliers with leading and trailing attributes doesn't allow us to reach our goal. Thankfully there is a way (there always is!). This is via UILayoutGuide. We can transparently introduce a UILayoutGuide with a percent-based width and then pin constraints on it.

// |-[layoutGuide(== x % width)-[view]

This has the advantage to work gracefully with RTL mode :)

UILayoutGuide is iOS 9.0 only so we'll have to raise our support (from iOS 8.0), but it's not a big deal since iOS 8.0 has been long dead and buried.

Going to update the release and let you know when you can try it out.

@mineschan the release has been updated with the fix, let me know how this goes :)

https://github.com/freshOS/Stevia/releases/tag/4.7.1

Thanks @s4cha !!

I tested with leading(%) and trailing(%) mix with leading(x) / trailing (x) / left(x) / right(x), all works perfectly!! You make my life so much easier :D

@mineschan Very happy to help 😃 !!!
Thanks a ton for your help and reactivity, this is very much appreciated 🙏

Youre welcome! Just, dont mind me that I brought you some coffee😌

@mineschan Thank you so much for the donation 😍.
Have a fantastic Day !!!