ProgressView Error

Hi, it's my first day learning Swift and I've encountered the following problem:

When running the code below, it returns the error:

compiler failed: Initializer 'init(value:total:) requires that 'int' conform to 'BinaryFloatingPoint'



struct MeetingView: View {

    var body: some View {

        VStack {

            ProgressView(value: 5, total: 15)

        }

    }

}



struct MeetingView_Previews: PreviewProvider {

    static var previews: some View {

        MeetingView()

    }

}

Help is appreciated, thanks.

Answered by Claude31 in 677697022

Try to set a Float value:

                    ProgressView(value: 5.0, total: 15)

Was trying to understand to basics via this website: https://developer.apple.com/tutorials/app-dev-training/using-stacks-to-arrange-views

As far as I tried, your code shown did not cause the issue you described. (I needed to fill the first line import SwiftUI, but that had nothing to do with the error, I think.)

Sometimes, Xcode might show some old bugs which was fixed already. Have you tried Clean Build Folder (Shift-Cmd-K) ? (Or you can choose it from Product menu.)

Accepted Answer

Try to set a Float value:

                    ProgressView(value: 5.0, total: 15)
ProgressView Error
 
 
Q