Skip to content

Commit 827fb9f

Browse files
authored
Merge pull request #24 from ServerDriven/watchos/support
Add basic WatchOS 7 support
2 parents 7a928d7 + 95d414c commit 827fb9f

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import PackageDescription
66
let package = Package(
77
name: "ScreenDataUI",
88
platforms: [
9-
.iOS(.v14)
9+
.iOS(.v14),
10+
.watchOS(.v7)
1011
],
1112
products: [
1213
// Products define the executables and libraries a package produces, and make them visible to other packages.

Sources/ScreenDataUI/Views/SDImage.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,20 @@ public struct SDImage: View {
6767
public var image: SomeImage
6868
private var progressTint: Color
6969

70+
private var screenWidth: CGFloat {
71+
#if os(iOS)
72+
UIScreen.main.bounds.width
73+
#else
74+
WKInterfaceDevice.current().screenBounds.width
75+
#endif
76+
}
77+
7078
private var width: CGFloat {
7179
guard let width = image.style?.width else {
7280
return .infinity
7381
}
7482

75-
if CGFloat(width) >= UIScreen.main.bounds.width {
83+
if CGFloat(width) >= screenWidth {
7684
return .infinity
7785
}
7886

0 commit comments

Comments
 (0)