Skip to content

Commit ff376ad

Browse files
committed
Fix an issue that the package could not build on the platform of Swift 5.8 or earlier
1 parent f5723af commit ff376ad

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
/.build
3+
build/
34
/Packages
45
xcuserdata/
56
DerivedData/

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PackageDescription
66
let package = Package(
77
name: "NSIcon",
88
platforms: [
9-
.macOS(.v12), .iOS(.v15), .watchOS(.v9)
9+
.iOS(.v15), .macOS(.v12), .watchOS(.v8)
1010
],
1111
products: [
1212
.library(

Sources/NSIcon/AppPlatform.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ extension AppPlatform {
2323
var mask: some View {
2424
switch self {
2525
case .iOS:
26-
AnyView {
26+
return AnyView(
2727
Image("AppIconMask", bundle: .module)
2828
.resizable()
29-
}
29+
)
3030
case .macOS:
31-
AnyView {
31+
return AnyView(
3232
Image("MacAppIconMask", bundle: .module)
3333
.resizable()
34-
}
34+
)
3535
case .watchOS:
36-
AnyView { Circle() }
36+
return AnyView(Circle())
3737
case .visionOS:
38-
AnyView { Circle() }
38+
return AnyView(Circle())
3939
}
4040
}
4141
}

Sources/NSIcon/Extensions.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension Image {
2121
func appIconMask(_ platform: AppPlatform) -> some View {
2222
switch platform {
2323
case .macOS:
24-
AnyView {
24+
return AnyView (
2525
GeometryReader { geometry in
2626
let shadowRadius = min(geometry.size.width, geometry.size.height) * (10/1024)
2727
let iconScale = CGFloat(824/1024)
@@ -35,13 +35,13 @@ extension Image {
3535
height: geometry.frame(in: .global).height)
3636
}
3737
.aspectRatio(1, contentMode: .fit)
38-
}
38+
)
3939
default:
40-
AnyView {
40+
return AnyView (
4141
self
4242
.iconDefault()
4343
.mask { platform.mask }
44-
}
44+
)
4545
}
4646
}
4747
}

0 commit comments

Comments
 (0)