Skip to content

Commit b542a82

Browse files
authored
Merge pull request #4 from mlch911/master
Add Cocoapods Support & Add BackwardCompatibility to iOS 9.0
2 parents b72535a + 3a9dcfa commit b542a82

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55

66
let package = Package(
77
name: "StackKit",
8-
platforms: [ .iOS(.v12)],
8+
platforms: [ .iOS(.v9)],
99
products: [
1010
.library(
1111
name: "StackKit",

Sources/StackKit/Stacks/Stacks/StackBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extension UIView {
2525

2626
stackView.translatesAutoresizingMaskIntoConstraints = false
2727

28-
if useSafeArea {
28+
if #available(iOS 11.0, *), useSafeArea {
2929
NSLayoutConstraint.activate([
3030
stackView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: .zero),
3131
stackView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor, constant: .zero),

Sources/StackKit/Stacks/Stacks/Stacks.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ public extension UIStackView {
108108
view.backgroundColor = color
109109
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
110110
view.layer.cornerRadius = cornerRadius
111-
view.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner]
111+
if #available(iOS 11.0, *) {
112+
view.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner]
113+
}
112114
insertSubview(view, at: 0)
113115
return self
114116
}

StackKit.podspec

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Be sure to run `pod lib lint StackKit.podspec' to ensure this is a
3+
# valid spec before submitting.
4+
#
5+
# Any lines starting with a # are optional, but their use is encouraged
6+
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
7+
#
8+
9+
Pod::Spec.new do |s|
10+
s.name = 'StackKit'
11+
s.version = '0.1.0'
12+
s.summary = 'The power of SwiftUI with UIKit'
13+
14+
# This description is used to generate tags and improve search results.
15+
# * Think: What does it do? Why did you write it? What is the focus?
16+
# * Try to keep it short, snappy and to the point.
17+
# * Write the description between the DESC delimiters below.
18+
# * Finally, don't worry about the indent, CocoaPods strips it!
19+
20+
s.description = <<-DESC
21+
StackKit harnesses the power of UIStackView's and Swift's ResultBuilders together. This allows you to easily build declarative UI while only using UIKit. StackKit is a great solution for anyone looking to level up their programmatic UI without having to convert an existing project to SwiftUI. Its API design is closely matched to SwiftUI making it effortless to pick up without having to accommodate any reactive programming patterns.
22+
DESC
23+
24+
s.homepage = 'https://github.com/gymshark/StackKit'
25+
s.screenshots = 'https://github.com/gymshark/ios-stack-kit/raw/master/Assets/example-1.png', 'https://github.com/gymshark/ios-stack-kit/raw/master/Assets/example-2.png'
26+
s.license = { :type => 'MIT', :file => 'LICENSE' }
27+
s.author = { 'gymshark' => 'engineering@gymshark.com' }
28+
s.source = { :git => 'https://github.com/gymshark/ios-stack-kit', :tag => s.version.to_s }
29+
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
30+
31+
s.ios.deployment_target = '9.0'
32+
33+
s.source_files = 'Sources/StackKit/**/*'
34+
35+
# s.resource_bundles = {
36+
# 'StackKit' => ['StackKit/Assets/*.png']
37+
# }
38+
39+
# s.public_header_files = 'Pod/Classes/**/*.h'
40+
# s.frameworks = 'UIKit', 'MapKit'
41+
# s.dependency 'AFNetworking', '~> 2.3'
42+
s.dependency 'ConstraintKit'
43+
end

0 commit comments

Comments
 (0)