11import AppKit
2+ import XcodesKit
23import Path
34import SwiftUI
45import Version
@@ -23,7 +24,7 @@ struct InfoPane: View {
2324
2425 Group {
2526 RuntimesView ( xcode: xcode)
26- ReleaseDateView ( date: xcode. releaseDate)
27+ ReleaseDateView ( date: xcode. releaseDate, url : xcode . releaseNotesURL )
2728 ReleaseNotesView ( url: xcode. releaseNotesURL)
2829 IdenticalBuildsView ( builds: xcode. identicalBuilds)
2930 CompatibilityView ( requiredMacOSVersion: xcode. requiredMacOSVersion)
@@ -37,14 +38,14 @@ struct InfoPane: View {
3738 }
3839}
3940
40- #Preview( PreviewName . allCases [ 0 ] . rawValue) { makePreviewContent ( for: 0 ) }
41- #Preview( PreviewName . allCases [ 1 ] . rawValue) { makePreviewContent ( for: 1 ) }
42- #Preview( PreviewName . allCases [ 2 ] . rawValue) { makePreviewContent ( for: 2 ) }
43- #Preview( PreviewName . allCases [ 3 ] . rawValue) { makePreviewContent ( for: 3 ) }
44- #Preview( PreviewName . allCases [ 4 ] . rawValue) { makePreviewContent ( for: 4 ) }
41+ #Preview( XcodePreviewName . allCases [ 0 ] . rawValue) { makePreviewContent ( for: 0 ) }
42+ #Preview( XcodePreviewName . allCases [ 1 ] . rawValue) { makePreviewContent ( for: 1 ) }
43+ #Preview( XcodePreviewName . allCases [ 2 ] . rawValue) { makePreviewContent ( for: 2 ) }
44+ #Preview( XcodePreviewName . allCases [ 3 ] . rawValue) { makePreviewContent ( for: 3 ) }
45+ #Preview( XcodePreviewName . allCases [ 4 ] . rawValue) { makePreviewContent ( for: 4 ) }
4546
4647private func makePreviewContent( for index: Int ) -> some View {
47- let name = PreviewName . allCases [ index]
48+ let name = XcodePreviewName . allCases [ index]
4849 return InfoPane ( xcode: xcodeDict [ name] !)
4950 . environmentObject ( configure ( AppState ( ) ) {
5051 $0. allXcodes = [ xcodeDict [ name] !]
@@ -53,17 +54,17 @@ private func makePreviewContent(for index: Int) -> some View {
5354 . padding ( )
5455}
5556
56- enum PreviewName : String , CaseIterable , Identifiable {
57+ enum XcodePreviewName : String , CaseIterable , Identifiable {
5758 case Populated_Installed_Selected
5859 case Populated_Installed_Unselected
5960 case Populated_Uninstalled
6061 case Basic_Installed
6162 case Basic_Installing
6263
63- var id : PreviewName { self }
64+ var id : XcodePreviewName { self }
6465}
6566
66- var xcodeDict : [ PreviewName : Xcode ] = [
67+ var xcodeDict : [ XcodePreviewName : Xcode ] = [
6768 . Populated_Installed_Selected: . init(
6869 version: _versionNoMeta,
6970 installState: . installed( Path ( _path) !) ,
@@ -121,15 +122,48 @@ var xcodeDict: [PreviewName: Xcode] = [
121122 ) ,
122123]
123124
125+ var downloadableRuntimes : [ DownloadableRuntime ] = {
126+ var runtimes = try ! JSONDecoder ( ) . decode ( [ DownloadableRuntime ] . self, from: Current . files. contents ( atPath: Path . runtimeCacheFile. string) !)
127+ // set iOS to installed
128+ let iOSIndex = runtimes. firstIndex { $0. sdkBuildUpdate == " 19E239 " } !
129+ var iOSRuntime = runtimes [ iOSIndex]
130+ iOSRuntime. installState = . installed
131+ runtimes [ iOSIndex] = iOSRuntime
132+
133+ let watchOSIndex = runtimes. firstIndex { $0. sdkBuildUpdate == " 20R362 " } !
134+ var runtime = runtimes [ watchOSIndex]
135+ runtime. installState = . installing(
136+ RuntimeInstallationStep . downloading (
137+ progress: configure ( Progress ( ) ) {
138+ $0. kind = . file
139+ $0. fileOperationKind = . downloading
140+ $0. estimatedTimeRemaining = 123
141+ $0. totalUnitCount = 11_944_848_484
142+ $0. completedUnitCount = 848_444_920
143+ $0. throughput = 9_211_681
144+ }
145+ )
146+ )
147+ runtimes [ watchOSIndex] = runtime
148+
149+ return runtimes
150+ } ( )
151+
152+ var installedRuntimes : [ CoreSimulatorImage ] = {
153+ [ CoreSimulatorImage ( uuid: " 85B22F5B-048B-4331-B6E2-F4196D8B7475 " , path: [ " relative " : " file:///Library/Developer/CoreSimulator/Images/85B22F5B-048B-4331-B6E2-F4196D8B7475.dmg " ] , runtimeInfo: CoreSimulatorRuntimeInfo ( build: " 19E240 " ) ) ] // same as iOS in _SDK's
154+ } ( )
155+
156+
124157private let _versionNoMeta = Version ( major: 12 , minor: 3 , patch: 0 )
125158private let _versionWithMeta = Version ( major: 12 , minor: 3 , patch: 1 , buildMetadataIdentifiers: [ " 1234A " ] )
126159private let _path = " /Applications/Xcode-12.3.0.app "
127160private let _requiredMacOSVersion = " 10.15.4 "
128161private let _sdks = SDKs (
129162 macOS: . init( number: " 11.1 " ) ,
130- iOS: . init( number: " 14.3 " ) ,
131- watchOS: . init( number: " 7.3 " ) ,
132- tvOS: . init( number: " 14.3 " )
163+ iOS: . init( number: " 15.4 " , " 19E239 " ) ,
164+ watchOS: . init( number: " 7.3 " , " 20R362 " ) ,
165+ tvOS: . init( number: " 14.3 " , " 20K67 " ) ,
166+ visionOS: . init( number: " 1.0 " , " 21N5233e " )
133167)
134168private let _compilers = Compilers (
135169 gcc: . init( number: " 4 " ) ,
0 commit comments