mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
rebase main
This commit is contained in:
parent
05f5c2cebf
commit
112829b553
3 changed files with 87 additions and 28 deletions
|
|
@ -16,6 +16,7 @@
|
|||
B0403CF02AD92D7B00137C09 /* ReleaseNotesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0403CEF2AD92D7B00137C09 /* ReleaseNotesView.swift */; };
|
||||
B0403CF22AD934B600137C09 /* CompatibilityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0403CF12AD934B600137C09 /* CompatibilityView.swift */; };
|
||||
B0403CF42AD9381D00137C09 /* SDKsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0403CF32AD9381D00137C09 /* SDKsView.swift */; };
|
||||
B0403CF62AD9849E00137C09 /* CompilersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0403CF52AD9849E00137C09 /* CompilersView.swift */; };
|
||||
B0C6AD042AD6E65700E64698 /* ReleaseDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */; };
|
||||
B0C6AD0B2AD9178E00E64698 /* IdenticalBuildView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */; };
|
||||
B0C6AD0D2AD91D7900E64698 /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0C2AD91D7900E64698 /* IconView.swift */; };
|
||||
|
|
@ -201,6 +202,7 @@
|
|||
B0403CEF2AD92D7B00137C09 /* ReleaseNotesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReleaseNotesView.swift; sourceTree = "<group>"; };
|
||||
B0403CF12AD934B600137C09 /* CompatibilityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompatibilityView.swift; sourceTree = "<group>"; };
|
||||
B0403CF32AD9381D00137C09 /* SDKsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKsView.swift; sourceTree = "<group>"; };
|
||||
B0403CF52AD9849E00137C09 /* CompilersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompilersView.swift; sourceTree = "<group>"; };
|
||||
B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReleaseDateView.swift; sourceTree = "<group>"; };
|
||||
B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdenticalBuildView.swift; sourceTree = "<group>"; };
|
||||
B0C6AD0C2AD91D7900E64698 /* IconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconView.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -629,6 +631,7 @@
|
|||
children = (
|
||||
B0403CEF2AD92D7B00137C09 /* ReleaseNotesView.swift */,
|
||||
B0403CF32AD9381D00137C09 /* SDKsView.swift */,
|
||||
B0403CF52AD9849E00137C09 /* CompilersView.swift */,
|
||||
B0403CF12AD934B600137C09 /* CompatibilityView.swift */,
|
||||
CAFBDC67259A308B003DCC5A /* InfoPane.swift */,
|
||||
E8E98A9525D863D700EC89A0 /* InstallationStepDetailView.swift */,
|
||||
|
|
@ -921,6 +924,7 @@
|
|||
CAE424B4259A764700B8B246 /* AppState+Install.swift in Sources */,
|
||||
CAE42487259A68A300B8B246 /* XcodeListCategory.swift in Sources */,
|
||||
CAA858C425A2BE4E00ACF8C0 /* Downloader.swift in Sources */,
|
||||
B0403CF62AD9849E00137C09 /* CompilersView.swift in Sources */,
|
||||
E8977EA325C11E1500835F80 /* PreferencesView.swift in Sources */,
|
||||
CA9FF87B2595293E00E47BAF /* DataSource.swift in Sources */,
|
||||
CABFA9C92592EEEA00380FEE /* URLRequest+Apple.swift in Sources */,
|
||||
|
|
|
|||
82
Xcodes/Frontend/InfoPane/CompilersView.swift
Normal file
82
Xcodes/Frontend/InfoPane/CompilersView.swift
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
//
|
||||
// CompilersView.swift
|
||||
// Xcodes
|
||||
//
|
||||
// Created by Duong Thai on 13/10/2023.
|
||||
// Copyright © 2023 Robots and Pencils. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import struct XCModel.Compilers
|
||||
|
||||
struct CompilersView: View {
|
||||
let compilers: Compilers?
|
||||
|
||||
var body: some View {
|
||||
if let compilers = compilers {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Compilers").font(.headline)
|
||||
Text(Self.content(from: compilers)).font(.subheadline)
|
||||
}
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
static func content(from compilers: Compilers) -> String {
|
||||
[ ("Swift", compilers.swift),
|
||||
("Clang", compilers.clang),
|
||||
("LLVM", compilers.llvm),
|
||||
("LLVM GCC", compilers.llvm_gcc),
|
||||
("GCC", compilers.gcc)
|
||||
].compactMap { // remove nil compiler
|
||||
guard $0.1 != nil, // has version array
|
||||
!$0.1!.isEmpty // has at least 1 version
|
||||
else { return nil }
|
||||
|
||||
let numbers = $0.1!.compactMap { $0.number } // remove nil number
|
||||
guard !numbers.isEmpty // has at least 1 number
|
||||
else { return nil }
|
||||
|
||||
// description for each type of compilers
|
||||
return "\($0.0): \(numbers.joined(separator: ", "))"
|
||||
}.joined(separator: "\n")
|
||||
}
|
||||
}
|
||||
|
||||
struct CompilersView_Preview: PreviewProvider {
|
||||
static var previews: some View {
|
||||
WrapperView()
|
||||
}
|
||||
}
|
||||
|
||||
private struct WrapperView: View {
|
||||
@State var isNil = false
|
||||
var compilers: Compilers? {
|
||||
isNil
|
||||
? nil
|
||||
: Compilers(
|
||||
gcc: .init(number: "4"),
|
||||
llvm_gcc: .init(number: "213"),
|
||||
llvm: .init(number: "2.3"),
|
||||
clang: .init(number: "7.3"),
|
||||
swift: .init(number: "5.3.2"))
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack {
|
||||
CompilersView(compilers: compilers)
|
||||
.border(.red)
|
||||
}
|
||||
Spacer()
|
||||
Toggle(isOn: $isNil) {
|
||||
Text("Is Nil?")
|
||||
}
|
||||
}
|
||||
.animation(.default)
|
||||
.frame(width: 200, height: 100)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ struct InfoPane: View {
|
|||
IdenticalBuildsView(builds: xcode.identicalBuilds)
|
||||
CompatibilityView(requiredMacOSVersion: xcode.requiredMacOSVersion)
|
||||
SDKsView(sdks: xcode.sdks)
|
||||
compilers(for: xcode)
|
||||
CompilersView(compilers: xcode.compilers)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
|
@ -73,33 +73,6 @@ struct InfoPane: View {
|
|||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func compilers(for xcode: Xcode) -> some View {
|
||||
if let compilers = xcode.compilers {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Compilers")
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
ForEach([
|
||||
("Swift", \Compilers.swift),
|
||||
("Clang", \.clang),
|
||||
("LLVM", \.llvm),
|
||||
("LLVM GCC", \.llvm_gcc),
|
||||
("GCC", \.gcc),
|
||||
], id: \.0) { row in
|
||||
if let sdk = compilers[keyPath: row.1] {
|
||||
Text("\(row.0): \(sdk.compactMap { $0.number }.joined(separator: ", "))")
|
||||
.font(.subheadline)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func downloadFileSize(for xcode: Xcode) -> some View {
|
||||
// if we've downloaded it no need to show the download size
|
||||
|
|
|
|||
Loading…
Reference in a new issue