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 04bc3277..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. */ @@ -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) } }