File tree Expand file tree Collapse file tree
Example/perian_justify_example
Sources/PersianJustify/Extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,12 @@ extension ViewController {
5353 fullWidthLabel2. numberOfLines = 0
5454 halfWidthLabel1. numberOfLines = 0
5555 halfWidthLabel2. numberOfLines = 0
56+ if #available( iOS 26 . 0 , * ) {
57+ fullWidthLabel1. fixDirectionForiOS26 ( )
58+ fullWidthLabel2. fixDirectionForiOS26 ( )
59+ halfWidthLabel1. fixDirectionForiOS26 ( )
60+ halfWidthLabel2. fixDirectionForiOS26 ( )
61+ }
5662 }
5763
5864 func fillLabels( ) {
Original file line number Diff line number Diff line change @@ -15,3 +15,15 @@ extension String {
1515 return toPJString ( fittingWidth: parentWidth, font: font)
1616 }
1717}
18+
19+ extension UILabel {
20+
21+ @available ( iOS 26 . 0 , * )
22+ func fixDirectionForiOS26( ) {
23+ if let traitOverrides = value ( forKey: " traitOverrides " ) as? NSObject {
24+ if traitOverrides. responds ( to: NSSelectorFromString ( " setResolvesNaturalAlignmentWithBaseWritingDirection: " ) ) {
25+ traitOverrides. setValue ( true , forKey: " resolvesNaturalAlignmentWithBaseWritingDirection " )
26+ }
27+ }
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments