mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-04-23 13:45:55 +00:00
fix how platforms are architecture filtered
This commit is contained in:
parent
6cf9647840
commit
fc50db1cee
5 changed files with 50 additions and 6 deletions
|
|
@ -11,7 +11,7 @@ import XcodesKit
|
||||||
|
|
||||||
struct PlatformsView: View {
|
struct PlatformsView: View {
|
||||||
@EnvironmentObject var appState: AppState
|
@EnvironmentObject var appState: AppState
|
||||||
@AppStorage("selectedRuntimeArchitecture") private var selectedRuntimeArchitecture: Architecture = .arm64
|
@AppStorage("selectedRuntimeArchitecture") private var selectedVariant: ArchitectureVariant = .universal
|
||||||
|
|
||||||
let xcode: Xcode
|
let xcode: Xcode
|
||||||
|
|
||||||
|
|
@ -22,7 +22,9 @@ struct PlatformsView: View {
|
||||||
appState.downloadableRuntimes.filter {
|
appState.downloadableRuntimes.filter {
|
||||||
$0.sdkBuildUpdate?.contains(sdkBuild) ?? false &&
|
$0.sdkBuildUpdate?.contains(sdkBuild) ?? false &&
|
||||||
($0.architectures?.isEmpty ?? true ||
|
($0.architectures?.isEmpty ?? true ||
|
||||||
$0.architectures?.contains(selectedRuntimeArchitecture) ?? false)
|
($0.architectures?.isUniversal ?? false && selectedVariant == .universal) ||
|
||||||
|
($0.architectures?.isAppleSilicon ?? false && selectedVariant == .appleSilicon)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,8 +37,8 @@ struct PlatformsView: View {
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
if !architectures.isEmpty {
|
if !architectures.isEmpty {
|
||||||
Spacer()
|
Spacer()
|
||||||
Picker("Architecture", selection: $selectedRuntimeArchitecture) {
|
Picker("Architecture", selection: $selectedVariant) {
|
||||||
ForEach(Architecture.allCases, id: \.self) { arch in
|
ForEach(ArchitectureVariant.allCases, id: \.self) { arch in
|
||||||
Label(arch.displayString, systemImage: arch.iconName)
|
Label(arch.displayString, systemImage: arch.iconName)
|
||||||
.tag(arch)
|
.tag(arch)
|
||||||
}
|
}
|
||||||
|
|
@ -73,6 +75,7 @@ struct PlatformsView: View {
|
||||||
ForEach(runtime.architectures ?? [], id: \.self) { architecture in
|
ForEach(runtime.architectures ?? [], id: \.self) { architecture in
|
||||||
TagView(text: architecture.displayString)
|
TagView(text: architecture.displayString)
|
||||||
}
|
}
|
||||||
|
|
||||||
pathIfAvailable(xcode: xcode, runtime: runtime)
|
pathIfAvailable(xcode: xcode, runtime: runtime)
|
||||||
|
|
||||||
if runtime.installState == .notInstalled {
|
if runtime.installState == .notInstalled {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{\rtf1\ansi\ansicpg1252\cocoartf2822
|
{\rtf1\ansi\ansicpg1252\cocoartf2865
|
||||||
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 .SFNS-Regular;}
|
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 .SFNS-Regular;}
|
||||||
{\colortbl;\red255\green255\blue255;}
|
{\colortbl;\red255\green255\blue255;}
|
||||||
{\*\expandedcolortbl;;}
|
{\*\expandedcolortbl;;}
|
||||||
|
|
|
||||||
|
|
@ -4819,6 +4819,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Architecture" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Authenticating" : {
|
"Authenticating" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
|
|
@ -5683,6 +5686,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Category" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Change" : {
|
"Change" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|
@ -9239,6 +9245,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"FilterArchitecturesDescription" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"FilterAvailableDescription" : {
|
"FilterAvailableDescription" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|
@ -13462,6 +13471,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Installed Only" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"InstallHelper" : {
|
"InstallHelper" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import PackageDescription
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "XcodesKit",
|
name: "XcodesKit",
|
||||||
platforms: [.macOS(.v11)],
|
platforms: [.macOS(.v13)],
|
||||||
products: [
|
products: [
|
||||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
.library(
|
.library(
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,37 @@ public enum Architecture: String, Codable, Equatable, Hashable, Identifiable, Ca
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ArchitectureVariant: String, Codable, Equatable, Hashable, Identifiable, CaseIterable {
|
||||||
|
public var id: Self { self }
|
||||||
|
|
||||||
|
case universal
|
||||||
|
case appleSilicon
|
||||||
|
|
||||||
|
public var displayString: String {
|
||||||
|
switch self {
|
||||||
|
case .appleSilicon:
|
||||||
|
return "Apple Silicon"
|
||||||
|
case .universal:
|
||||||
|
return "Universal"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var iconName: String {
|
||||||
|
switch self {
|
||||||
|
case .appleSilicon:
|
||||||
|
return "m4.button.horizontal"
|
||||||
|
case .universal:
|
||||||
|
return "cpu.fill"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension Array where Element == Architecture {
|
extension Array where Element == Architecture {
|
||||||
public var isAppleSilicon: Bool {
|
public var isAppleSilicon: Bool {
|
||||||
self == [.arm64]
|
self == [.arm64]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var isUniversal: Bool {
|
||||||
|
self.contains([.arm64, .x86_64])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue