Skip to content

Commit 10ce2b8

Browse files
committed
support filtering
1 parent 14b2b3d commit 10ce2b8

4 files changed

Lines changed: 65 additions & 16 deletions

File tree

Xcodes.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
E8DA461125FAF7FB002E85EF /* NotificationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8DA461025FAF7FB002E85EF /* NotificationsView.swift */; };
141141
E8E98A9025D8631800EC89A0 /* InstallationStepRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAFBC3FF259AC17F00E2A3D8 /* InstallationStepRowView.swift */; };
142142
E8E98A9625D863D700EC89A0 /* InstallationStepDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8E98A9525D863D700EC89A0 /* InstallationStepDetailView.swift */; };
143+
E8EE58C02E1CC2A50003FA9F /* RuntimeArchitecture.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8EE58BF2E1CC2A50003FA9F /* RuntimeArchitecture.swift */; };
143144
E8F44A1E296B4CD7002D6592 /* Path in Frameworks */ = {isa = PBXBuildFile; productRef = E8F44A1D296B4CD7002D6592 /* Path */; };
144145
E8FA00542B5B109800769CE0 /* com.xcodesorg.xcodesapp.Helper in Copy Helper */ = {isa = PBXBuildFile; fileRef = CA9FF8AE2595967A00E47BAF /* com.xcodesorg.xcodesapp.Helper */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
145146
E8FD5727291EE4AC001E004C /* AsyncNetworkService in Frameworks */ = {isa = PBXBuildFile; productRef = E8FD5726291EE4AC001E004C /* AsyncNetworkService */; };
@@ -342,6 +343,7 @@
342343
E8D655BF288DD04700A139C2 /* SelectedActionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectedActionType.swift; sourceTree = "<group>"; };
343344
E8DA461025FAF7FB002E85EF /* NotificationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsView.swift; sourceTree = "<group>"; };
344345
E8E98A9525D863D700EC89A0 /* InstallationStepDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstallationStepDetailView.swift; sourceTree = "<group>"; };
346+
E8EE58BF2E1CC2A50003FA9F /* RuntimeArchitecture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuntimeArchitecture.swift; sourceTree = "<group>"; };
345347
/* End PBXFileReference section */
346348

347349
/* Begin PBXFrameworksBuildPhase section */
@@ -660,6 +662,7 @@
660662
E8E98A9425D863B100EC89A0 /* InfoPane */ = {
661663
isa = PBXGroup;
662664
children = (
665+
E8EE58BF2E1CC2A50003FA9F /* RuntimeArchitecture.swift */,
663666
B0403CEF2AD92D7B00137C09 /* ReleaseNotesView.swift */,
664667
B0403CF32AD9381D00137C09 /* SDKsView.swift */,
665668
B0403CF52AD9849E00137C09 /* CompilersView.swift */,
@@ -939,6 +942,7 @@
939942
53CBAB2C263DCC9100410495 /* XcodesAlert.swift in Sources */,
940943
332807412CA5EA820036F691 /* SignInSecurityKeyTouchView.swift in Sources */,
941944
CA61A6E0259835580008926E /* Xcode.swift in Sources */,
945+
E8EE58C02E1CC2A50003FA9F /* RuntimeArchitecture.swift in Sources */,
942946
CAE4247F259A666100B8B246 /* MainWindow.swift in Sources */,
943947
CA452BB0259FD9770072DFA4 /* ProgressIndicator.swift in Sources */,
944948
B0403CF02AD92D7B00137C09 /* ReleaseNotesView.swift in Sources */,

Xcodes/Frontend/InfoPane/InfoPane.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ struct InfoPane: View {
3535
}
3636
.xcodesBackground()
3737

38-
VStack {
39-
Text("Platforms")
40-
.font(.title3)
41-
.frame(maxWidth: .infinity, alignment: .leading)
42-
PlatformsView(xcode: xcode)
43-
}
44-
.xcodesBackground()
38+
PlatformsView(xcode: xcode)
4539
}
4640
.frame(minWidth: 380)
4741

Xcodes/Frontend/InfoPane/PlatformsView.swift

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,59 @@ import XcodesKit
1111

1212
struct PlatformsView: View {
1313
@EnvironmentObject var appState: AppState
14-
14+
@AppStorage("selectedRuntimeArchitecture") private var selectedRuntimeArchitecture: RuntimeArchitecture = .arm64
15+
1516
let xcode: Xcode
1617

1718
var body: some View {
1819

1920
let builds = xcode.sdks?.allBuilds()
2021
let runtimes = builds?.flatMap { sdkBuild in
2122
appState.downloadableRuntimes.filter {
22-
$0.sdkBuildUpdate?.contains(sdkBuild) ?? false
23+
$0.sdkBuildUpdate?.contains(sdkBuild) ?? false &&
24+
($0.architectures?.isEmpty ?? true ||
25+
$0.architectures?.contains(selectedRuntimeArchitecture.rawValue) ?? false)
2326
}
2427
}
25-
26-
ForEach(runtimes ?? [], id: \.identifier) { runtime in
27-
runtimeView(runtime: runtime)
28-
.frame(minWidth: 200)
29-
.padding()
30-
.background(.quinary)
31-
.clipShape(RoundedRectangle(cornerRadius: 5, style: .continuous))
28+
29+
let architectures = Set((runtimes ?? []).flatMap { $0.architectures ?? [] })
30+
31+
VStack {
32+
HStack {
33+
Text("Platforms")
34+
.font(.title3)
35+
.frame(maxWidth: .infinity, alignment: .leading)
36+
if !architectures.isEmpty {
37+
Spacer()
38+
Button {
39+
switch selectedRuntimeArchitecture {
40+
case .arm64: selectedRuntimeArchitecture = .x86_64
41+
case .x86_64: selectedRuntimeArchitecture = .arm64
42+
}
43+
} label: {
44+
switch selectedRuntimeArchitecture {
45+
case .arm64:
46+
Label(selectedRuntimeArchitecture.displayValue, systemImage: "m4.button.horizontal")
47+
.labelStyle(.trailingIcon)
48+
case .x86_64:
49+
Label(selectedRuntimeArchitecture.displayValue, systemImage: "cpu.fill")
50+
.labelStyle(.trailingIcon)
51+
}
52+
}
53+
}
54+
}
55+
56+
ForEach(runtimes ?? [], id: \.identifier) { runtime in
57+
runtimeView(runtime: runtime)
58+
.frame(minWidth: 200)
59+
.padding()
60+
.background(.quinary)
61+
.clipShape(RoundedRectangle(cornerRadius: 5, style: .continuous))
62+
}
3263
}
64+
.xcodesBackground()
65+
66+
3367
}
3468

3569
@ViewBuilder
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// RuntimeArchitecture.swift
3+
// Xcodes
4+
//
5+
// Created by Matt Kiazyk on 2025-07-07.
6+
//
7+
8+
enum RuntimeArchitecture: String, CaseIterable, Identifiable {
9+
case arm64
10+
case x86_64
11+
12+
var id: Self { self }
13+
14+
var displayValue: String {
15+
return rawValue
16+
}
17+
}

0 commit comments

Comments
 (0)