progress bar will not work in swiftUI here is the code I used.
Code Block import SwiftUI struct ContentView: View { @State private var progress = 0 var body: some View { ProgressView(value: $progress) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Thanks for showing the error message. That will help readers find what's happening in your code.Initializer 'init(value:total:)' requires that 'Binding<Int>' conform to 'BinaryFloatingPoint'
The initializer of ProgressView you are trying has this signature:
Code Block init<V>(value: V?, total: V = 1.0) where Label == EmptyView, CurrentValueLabel == EmptyView, V : BinaryFloatingPoint
The value passed to value: needs to be of some type BinaryFloatingPoint, not Binding nor Int.
Code Block struct ContentView: View { @State private var progress: Double = 0 //<- A type conforming to `BinaryFloatingPoint` var body: some View { ProgressView(value: progress) //<- No `$` here } }