Skip to content

Commit 40264eb

Browse files
committed
Update codes
1 parent de14abb commit 40264eb

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

BKStackLayout.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
77
s.author = { "Burt.K" => "skyfe79@gmail.com" }
88
s.social_media_url = "http://twitter.com/skyfe79"
99
s.ios.deployment_target = "9.0"
10-
s.osx.deployment_target = "10.10"
10+
s.osx.deployment_target = "10.11"
1111
s.swift_version = "4.2"
1212
s.source = { :git => "https://github.com/ReactComponentKit/BKStackLayout.git", :tag => "#{s.version}" }
1313
s.source_files = "BKStackLayout/**/{*.swift}"

BKStackLayout/StackLayout.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@ public typealias SLView = UIView
1919
public typealias SLStackView = UIStackView
2020
public typealias SLColor = UIColor
2121
public typealias SLEdgeInsets = UIEdgeInsets
22+
public typealias SLLayoutPriority = UILayoutPriority
23+
public typealias SLAlignment = UIStackView.Alignment
24+
public typealias SLScreen = UIScreen
2225
#else
2326
public typealias SLView = NSView
2427
public typealias SLStackView = NSStackView
2528
public typealias SLColor = NSColor
2629
public typealias SLEdgeInsets = NSEdgeInsets
30+
public typealias SLLayoutPriority = NSLayoutPriority
31+
public typealias SLAlignment = NSLayoutConstraint.Attribute
32+
public typealias SLScreen = NSScreen
2733
#endif
2834

2935
fileprivate protocol StackLayoutUpdatable {
@@ -116,7 +122,7 @@ public class StackLayout: SLView, StackLayoutUpdatable {
116122
case firstBaseline
117123
case lastBaseline
118124

119-
fileprivate var toAlignment: SLStackView.Alignment {
125+
fileprivate var toAlignment: SLAlignment {
120126
switch self {
121127
case .top:
122128
return .top
@@ -140,7 +146,7 @@ public class StackLayout: SLView, StackLayoutUpdatable {
140146
case right
141147
case fill
142148

143-
fileprivate var toAlignment: SLStackView.Alignment {
149+
fileprivate var toAlignment: SLAlignment {
144150
switch self {
145151
case .left:
146152
return .leading
@@ -239,17 +245,17 @@ extension StackLayout {
239245
public func add(views: [SLView]) -> StackLayout {
240246
self.layoutViews = views
241247
self.layoutViews.filter { $0 is StackLayoutStretchable == false }.forEach {
242-
$0.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1000), for: orientation == .vertical ? .vertical : .horizontal)
248+
$0.setContentCompressionResistancePriority(SLLayoutPriority(rawValue: 1000), for: orientation == .vertical ? .vertical : .horizontal)
243249
}
244250
return self
245251
}
246252

247253
public func flex(bgColor: SLColor = .clear) -> SLView {
248-
let width = orientation == .vertical ? 1 : UIScreen.main.bounds.width
249-
let height = orientation == .vertical ? UIScreen.main.bounds.height : 1
254+
let width = orientation == .vertical ? 1 : SLScreen.main.bounds.width
255+
let height = orientation == .vertical ? SLScreen.main.bounds.height : 1
250256
let v = StackFlexSpacingView(width: width, height: height)
251257
v.backgroundColor = bgColor
252-
v.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 999), for: orientation == .vertical ? .vertical : .horizontal)
258+
v.setContentCompressionResistancePriority(SLLayoutPriority(rawValue: 999), for: orientation == .vertical ? .vertical : .horizontal)
253259
return v
254260
}
255261

0 commit comments

Comments
 (0)