diff --git a/Xcodes/Backend/XcodeCommands.swift b/Xcodes/Backend/XcodeCommands.swift index 2913af5..97f36b3 100644 --- a/Xcodes/Backend/XcodeCommands.swift +++ b/Xcodes/Backend/XcodeCommands.swift @@ -35,16 +35,21 @@ struct XcodeCommands: Commands { struct InstallButton: View { @EnvironmentObject var appState: AppState + @State private var isLoading = false + let xcode: Xcode? - + var body: some View { - Button(action: install) { + ProgressButton(isInProgress: isLoading) { + install() + } label: { Text("Install") - .help("Install") + .help("InstallDescription") } } - + private func install() { + isLoading = true guard let xcode = xcode else { return } appState.checkMinVersionAndInstall(id: xcode.id) } diff --git a/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift b/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift index 555c361..55f431c 100644 --- a/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift +++ b/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift @@ -110,10 +110,9 @@ struct XcodeListViewRow: View { .buttonStyle(AppStoreButtonStyle(primary: true, highlighted: selected)) .help("OpenDescription") case .notInstalled: - Button("Install") { appState.checkMinVersionAndInstall(id: xcode.id) } + InstallButton(xcode: xcode) .textCase(.uppercase) - .buttonStyle(AppStoreButtonStyle(primary: false, highlighted: selected)) - .help("InstallDescription") + .buttonStyle(AppStoreButtonStyle(primary: false, highlighted: false)) case let .installing(installationStep): InstallationStepRowView( installationStep: installationStep,