Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Fix RTL supports within UIScrollView #264

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LayoutKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
8 changes: 6 additions & 2 deletions Sources/LayoutArrangement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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)
}
}
Expand Down