Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 5965334

Browse files
authored
Fix it
1 parent f4dce12 commit 5965334

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
11
import Foundation
22
import Combine
33

4-
public func installAppWithStatus(from ipaURL: URL) async throws {
5-
let viewModel = InstallerStatusViewModel()
6-
7-
// Connect Combine publishers to your UI
4+
public func installAppWithStatus(from ipaURL: URL, viewModel: InstallerStatusViewModel) async throws {
85
var cancellables = Set<AnyCancellable>()
96

107
viewModel.$uploadProgress
11-
.sink { [weak self] progress in
8+
.sink { progress in
129
DispatchQueue.main.async {
13-
self?.status = "📦 Uploading: \(Int(progress * 100))%"
14-
self?.progress = 0.5 + (progress * 0.25) // optional fine-tune
10+
viewModel.status = "📦 Uploading: \(Int(progress * 100))%"
11+
viewModel.progress = 0.5 + (progress * 0.25)
1512
}
1613
}
1714
.store(in: &cancellables)
1815

1916
viewModel.$installProgress
20-
.sink { [weak self] progress in
17+
.sink { progress in
2118
DispatchQueue.main.async {
22-
self?.status = "📲 Installing: \(Int(progress * 100))%"
23-
self?.progress = 0.75 + (progress * 0.25) // optional fine-tune
19+
viewModel.status = "📲 Installing: \(Int(progress * 100))%"
20+
viewModel.progress = 0.75 + (progress * 0.25)
2421
}
2522
}
2623
.store(in: &cancellables)
2724

2825
viewModel.$status
29-
.sink { [weak self] status in
26+
.sink { status in
3027
DispatchQueue.main.async {
31-
self?.status = status
28+
viewModel.status = status
3229
}
3330
}
3431
.store(in: &cancellables)
35-
32+
3633
let installer = InstallationProxy(viewModel: viewModel)
3734
try await installer.install(at: ipaURL)
3835
}

0 commit comments

Comments
 (0)