airbnb / MagazineLayout

A collection view layout capable of laying out views in vertically scrolling grids and lists.
Apache License 2.0
3.3k stars 220 forks source link

Enable RTL language support #30

Closed bryankeller closed 5 years ago

bryankeller commented 5 years ago

Details

This adds support for right-to-left layouts, which is useful when supporting RTL languages like Hebrew and Arabic. The default value of this read-only UICollectionViewLayout property, flipsHorizontallyInOppositeLayoutDirection, is false. If there is enough demand for turning this behavior off, we can make it configurable via a public API addition.

Sample app Airbnb app
Simulator Screen Shot - iPhone 8 - 2019-04-01 at 15 47 46 Simulator Screen Shot - iPhone 8 - 2019-04-01 at 16 14 15

Related Issue

N/A

Motivation and Context

The layout direction changes to be RTL when setting the device language to an RTL language. We must return true for this property to enable the collection view's coordinate system to get flipped horizontally.

How Has This Been Tested

Tested by changing the device language to Hebrew and confirming the layout direction matches the text direction.

Types of changes

Checklist