From 2988ffb976aa9a36302983ff3172d8c33a7afc18 Mon Sep 17 00:00:00 2001 From: chml Date: Mon, 3 Aug 2020 00:23:36 +0800 Subject: [PATCH 1/2] Fix RTL layout inside UIScrollView --- Sources/LayoutArrangement.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/LayoutArrangement.swift b/Sources/LayoutArrangement.swift index 04bc3277..e425c133 100644 --- a/Sources/LayoutArrangement.swift +++ b/Sources/LayoutArrangement.swift @@ -115,8 +115,12 @@ public struct LayoutArrangement { /// Flips the right and left edges of the view's subviews. private func flipSubviewsHorizontally(_ view: View) { + var width = view.bounds.width + if let scrollView = view as? UIScrollView { + width = scrollView.contentSize.width + } for subview in view.subviews { - subview.frame.origin.x = view.frame.width - subview.frame.maxX + subview.frame.origin.x = width - subview.frame.maxX flipSubviewsHorizontally(subview) } } From 84af184d737e2de850db0a864dbb9a52be68f247 Mon Sep 17 00:00:00 2001 From: chml Date: Wed, 5 Aug 2020 11:08:53 +0800 Subject: [PATCH 2/2] import UIKit --- LayoutKit.podspec | 1 + Sources/LayoutArrangement.swift | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/LayoutKit.podspec b/LayoutKit.podspec index e1251821..d3ab9a77 100644 --- a/LayoutKit.podspec +++ b/LayoutKit.podspec @@ -9,6 +9,7 @@ Pod::Spec.new do |spec| spec.source_files = 'Sources/**/*.swift' spec.documentation_url = 'http://layoutkit.org' + spec.swift_versions = ['5'] spec.ios.deployment_target = '8.0' spec.ios.frameworks = 'Foundation', 'CoreGraphics', 'UIKit' spec.ios.exclude_files = [ diff --git a/Sources/LayoutArrangement.swift b/Sources/LayoutArrangement.swift index e425c133..d5485da4 100644 --- a/Sources/LayoutArrangement.swift +++ b/Sources/LayoutArrangement.swift @@ -7,7 +7,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import CoreGraphics - +import UIKit /** The frame of a layout and the frames of its sublayouts. */