mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
52 lines
1.6 KiB
Swift
52 lines
1.6 KiB
Swift
//
|
|
// InfoPaneControls.swift
|
|
// Xcodes
|
|
//
|
|
// Created by Duong Thai on 14/10/2023.
|
|
// Copyright © 2023 Robots and Pencils. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct InfoPaneControls: View {
|
|
let xcode: Xcode
|
|
|
|
var body: some View {
|
|
VStack (alignment: .leading) {
|
|
switch xcode.installState {
|
|
case .notInstalled:
|
|
HStack {
|
|
Spacer()
|
|
NotInstalledStateButtons(
|
|
downloadFileSizeString: xcode.downloadFileSizeString,
|
|
id: xcode.id)
|
|
}
|
|
|
|
case .installing(let installationStep):
|
|
HStack(alignment: .top) {
|
|
InstallationStepDetailView(installationStep: installationStep)
|
|
CancelInstallButton(xcode: xcode)
|
|
}
|
|
case .installed(_):
|
|
InstalledStateButtons(xcode: xcode)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview(XcodePreviewName.allCases[0].rawValue) { makePreviewContent(for: 0) }
|
|
#Preview(XcodePreviewName.allCases[1].rawValue) { makePreviewContent(for: 1) }
|
|
#Preview(XcodePreviewName.allCases[2].rawValue) { makePreviewContent(for: 2) }
|
|
#Preview(XcodePreviewName.allCases[3].rawValue) { makePreviewContent(for: 3) }
|
|
#Preview(XcodePreviewName.allCases[4].rawValue) { makePreviewContent(for: 4) }
|
|
|
|
private func makePreviewContent(for index: Int) -> some View {
|
|
let name = XcodePreviewName.allCases[index]
|
|
|
|
return InfoPaneControls(xcode: xcodeDict[name]!)
|
|
.environmentObject(configure(AppState()) {
|
|
$0.allXcodes = [xcodeDict[name]!]
|
|
})
|
|
.frame(width: 300)
|
|
.padding()
|
|
}
|