Skip to content

Commit 126be74

Browse files
author
JWI
committed
changed some stuff in widget
1 parent 1704855 commit 126be74

File tree

5 files changed

+31
-12
lines changed

5 files changed

+31
-12
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ let package = Package(
4747
name: "swift-cross-ui",
4848
platforms: [
4949
.macOS(.v10_15),
50-
.iOS("13.0"),
50+
.iOS("7.0"),
5151
.tvOS(.v13),
5252
.macCatalyst(.v13)
5353
],

Sources/SwiftCrossUI/Views/List.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//MARK: Will add to a shim library later, just here for testing now.
2-
/*@available(iOS, introduced: 6.0, obsoleted: 13.0)
2+
@available(iOS, introduced: 6.0, obsoleted: 13.0)
33
public protocol Identifiable {
44
associatedtype ID: Hashable
55
var id: ID { get }
6-
}*/
6+
}
77

88
public struct List<SelectionValue: Hashable, RowView: View>: TypeSafeView, View {
99
typealias Children = ListViewChildren<PaddingModifierView<RowView>>

Sources/UIKitBackend/UIColor+Color.swift

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,21 @@ extension Color {
3030
}
3131

3232
var cgColor: CGColor {
33-
CGColor(
34-
red: CGFloat(red),
35-
green: CGFloat(green),
36-
blue: CGFloat(blue),
37-
alpha: CGFloat(alpha)
38-
)
33+
if #available(iOS 13.0, *) {
34+
CGColor(
35+
red: CGFloat(red),
36+
green: CGFloat(green),
37+
blue: CGFloat(blue),
38+
alpha: CGFloat(alpha)
39+
)
40+
} else {
41+
//MARK: this won't work right now, get back to me on it.
42+
CGColorShim(
43+
red: CGFloat(red),
44+
green: CGFloat(green),
45+
blue: CGFloat(blue),
46+
alpha: CGFloat(alpha)
47+
) as! CGColor
48+
}
3949
}
4050
}

Sources/UIKitBackend/Widget.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,20 @@ class WrapperWidget<View: UIView>: BaseViewWidget {
289289
self.addSubview(child)
290290
child.translatesAutoresizingMaskIntoConstraints = false
291291
NSLayoutConstraint.activate([
292-
child.topAnchor.constraint(equalTo: self.topAnchor),
292+
{
293+
let c = child.topAnchor.constraint(equalTo: self.topAnchor)
294+
c.priority = .defaultHigh
295+
return c
296+
}(),
293297
child.leadingAnchor.constraint(equalTo: self.leadingAnchor),
294-
child.bottomAnchor.constraint(equalTo: self.bottomAnchor),
298+
{
299+
let c = child.bottomAnchor.constraint(equalTo: self.bottomAnchor)
300+
c.priority = .defaultHigh
301+
return c
302+
}(),
295303
child.trailingAnchor.constraint(equalTo: self.trailingAnchor),
296304
])
305+
297306
}
298307

299308
override convenience init() {

0 commit comments

Comments
 (0)