66// Copyright © 2023 Robots and Pencils. All rights reserved.
77//
88
9- import SwiftUI
109import Path
10+ import SwiftUI
11+ import Version
1112
1213struct 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}
0 commit comments