diff --git a/Sources/SwiftUIKit/Containers/HScroll.swift b/Sources/SwiftUIKit/Containers/HScroll.swift new file mode 100644 index 0000000..eb153ea --- /dev/null +++ b/Sources/SwiftUIKit/Containers/HScroll.swift @@ -0,0 +1,37 @@ +// +// HScroll.swift +// SwiftUIKit +// +// Created by Zach Eriksen on 9/1/20. +// + +import UIKit + +@available(iOS 9.0, *) +public class HScroll: UIView { + + public init(withPadding padding: Float = 0, + _ closure: () -> UIView) { + super.init(frame: .zero) + + let scrollableView = closure() + + let scrollView = ScrollView { + scrollableView + } + + embed { + scrollView + } + .configure { parentView in + NSLayoutConstraint.activate([ + scrollableView.topAnchor.constraint(equalTo: parentView.topAnchor, constant: CGFloat(padding)), + scrollableView.bottomAnchor.constraint(equalTo: parentView.bottomAnchor, constant: CGFloat(-padding)) + ]) + } + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/Sources/SwiftUIKit/Containers/VScroll.swift b/Sources/SwiftUIKit/Containers/VScroll.swift new file mode 100644 index 0000000..2793fce --- /dev/null +++ b/Sources/SwiftUIKit/Containers/VScroll.swift @@ -0,0 +1,37 @@ +// +// VScroll.swift +// SwiftUIKit +// +// Created by Zach Eriksen on 9/1/20. +// + +import UIKit + +@available(iOS 9.0, *) +public class VScroll: UIView { + + public init(withPadding padding: Float = 0, + _ closure: () -> UIView) { + super.init(frame: .zero) + + let scrollableView = closure() + + let scrollView = ScrollView { + scrollableView + } + + embed { + scrollView + } + .configure { parentView in + NSLayoutConstraint.activate([ + scrollableView.leadingAnchor.constraint(equalTo: parentView.leadingAnchor, constant: CGFloat(padding)), + scrollableView.trailingAnchor.constraint(equalTo: parentView.trailingAnchor, constant: CGFloat(-padding)) + ]) + } + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/SwiftUIKit_ccpods.podspec b/SwiftUIKit_ccpods.podspec deleted file mode 100644 index 677653e..0000000 --- a/SwiftUIKit_ccpods.podspec +++ /dev/null @@ -1,20 +0,0 @@ -Pod::Spec.new do |s| - -s.platform = :ios -s.ios.deployment_target = '9.0' -s.name = "SwiftUIKit_ccpods" -s.summary = "UIKit implementation of SwiftUI" -s.requires_arc = true -s.swift_version = '5.0' - -s.version = "1.0.0" - -s.license = { :type => 'MIT' } -s.author = { "Zach Eriksen" => "zmeriksen@icloud.com" } -s.homepage = "https://github.com/zmeriksen/SwiftUIKit" -s.source = { :git => "https://github.com/zmeriksen/SwiftUIKit.git", :tag => "#{s.version}"} - -s.ios.framework = "UIKit" -s.source_files = "Sources/**/*.swift" - -end