Skip to content

Commit dbf3000

Browse files
authored
Merge pull request #530 from huihuisang/feature/replace-default-icon-in-info
replace default icon in info page
2 parents 7359ae1 + f4c9a6d commit dbf3000

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

Xcodes/Frontend/InfoPane/IconView.swift

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
// Copyright © 2023 Robots and Pencils. All rights reserved.
77
//
88

9-
import SwiftUI
109
import Path
10+
import SwiftUI
11+
import Version
1112

1213
struct IconView: View {
13-
let installState: XcodeInstallState
14+
let xcode: Xcode
1415

1516
var body: some View {
16-
if case let .installed(path) = installState {
17+
if case let .installed(path) = xcode.installState {
1718
Image(nsImage: NSWorkspace.shared.icon(forFile: path.string))
1819
} else {
19-
Image(systemName: "app.fill")
20+
Image(xcode.version.isPrerelease ? "xcode-beta" : "xcode")
2021
.resizable()
2122
.frame(width: 32, height: 32)
2223
.foregroundColor(.secondary)
@@ -25,13 +26,19 @@ struct IconView: View {
2526
}
2627

2728
#Preview("Installed") {
28-
IconView(installState: XcodeInstallState.installed(Path("/Applications/Xcode.app")!))
29-
.frame(width: 300, height: 100)
30-
.padding()
29+
IconView(xcode: Xcode(version: Version("12.3.0")!, installState: .installed(Path("/Applications/Xcode-12.3.0.app")!), selected: true, icon: nil))
30+
.frame(width: 300, height: 100)
31+
.padding()
32+
}
33+
34+
#Preview("Installed") {
35+
IconView(xcode: Xcode(version: Version("12.3.0")!, installState: .notInstalled, selected: true, icon: nil))
36+
.frame(width: 300, height: 100)
37+
.padding()
3138
}
3239

3340
#Preview("Not Installed") {
34-
IconView(installState: XcodeInstallState.notInstalled)
35-
.frame(width: 300, height: 100)
36-
.padding()
41+
IconView(xcode: Xcode(version: Version("12.0.0-1234A")!, installState: .notInstalled, selected: false, icon: nil))
42+
.frame(width: 300, height: 100)
43+
.padding()
3744
}

Xcodes/Frontend/InfoPane/InfoPane.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct InfoPane: View {
1414
VStack {
1515
VStack(spacing: 5) {
1616
HStack {
17-
IconView(installState: xcode.installState)
17+
IconView(xcode: xcode)
1818

1919
Text(verbatim: "Xcode \(xcode.description) \(xcode.version.buildMetadataIdentifiersDisplay)")
2020
.font(.title)

0 commit comments

Comments
 (0)