After some further communication with DTS (Thanks Paris!), a workaround is to use XXViewRepresentable to wrap a platform-specific progress view. Here is my solution:
import SwiftUI
#if os(macOS)
import AppKit
public typealias SuperClass = NSViewRepresentable
#else
import UIKit
public typealias SuperClass = UIViewRepresentable
#endif
public struct RepresentedProgressView: SuperClass {
@State public private(set) var progress: Progress
public init(_ progress: Progress) {
self.progress = progress
}
#if os(macOS)
public func makeNSView(context: Self.Context) -> NSProgressIndicator {
let view = NSProgressIndicator()
view.observedProgress = progress
return view
}
public func updateNSView(_ uiView: Self.NSViewType, context: Self.Context) {
}
#else
public func makeUIView(context: Self.Context) -> UIProgressView {
let view = UIProgressView()
view.observedProgress = progress
return view
}
public func updateUIView(_ uiView: Self.UIViewType, context: Self.Context) {
}
#endif
}
This is working in our code, and doesn't crash with > 60 files transferred
Topic:
App & System Services
SubTopic:
Networking
Tags: