/ Jade / Views / Toolbar / DownloadProgressView.swift
DownloadProgressView.swift
 1  //
 2  //  DownloadProgressView.swift
 3  //  MLXChatExample
 4  //
 5  //  Created by İbrahim Çetin on 21.04.2025.
 6  //
 7  
 8  import SwiftUI
 9  
10  struct DownloadProgressView: View {
11      let progress: Progress
12  
13      @State private var isShowingDownload = false
14  
15      var body: some View {
16          Button {
17              isShowingDownload = true
18          } label: {
19              Image(systemName: "arrow.down.square")
20                  .foregroundStyle(.tint)
21          }
22          .popover(isPresented: $isShowingDownload, arrowEdge: .bottom) {
23              VStack {
24                  ProgressView(value: progress.fractionCompleted) {
25                      HStack {
26                          Text(progress.localizedAdditionalDescription)
27                              .bold()
28                          Spacer()
29                          Text(progress.localizedDescription)
30                      }
31                  }
32  
33                  Text("The model is downloading")
34                      .padding(.horizontal, 32)
35              }
36              .padding()
37          }
38      }
39  }
40  
41  #Preview {
42      DownloadProgressView(progress: Progress(totalUnitCount: 6))
43  }