UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: xcode compiler had to be stopped, then it was indexing forever ... How do I submit a bug report on a problem that I can recreate

Forums > SwiftUI

I found what was causing this by using Text(parsclass.yardageFront9) rather than Text("(parsclass.yardageFront9)")

I would like to submit a bug report, but I have never done that and do not know how.

Any assistance would be appreciated, and may your syntax always be correct


class parsClass: NSObject {
    var pars = [parsRec]()

    var parFront9:  Int { return pars.filter({ $0.Hole < 10 }).map({ $0.Par }).reduce(0, +) }
    var parBack9:  Int { return pars.filter({ $0.Hole > 9 }).map({ $0.Par }).reduce(0, +) }
    var parBack18:  Int { return pars.reduce(0, {$0 + $1.Par}) }

    var yardageFront9:  Int { return pars.filter({ $0.Hole < 10 }).map({ $0.Yardage }).reduce(0, +) }
    var yardageBack9:  Int { return pars.filter({ $0.Hole > 9 }).map({ $0.Yardage }).reduce(0, +) }
    var yardageBack18:  Int { return pars.reduce(0, {$0 + $1.Yardage}) }
}

struct parsRec {
    var CourseID: Int
    var TeeID: Int
    var Hole: Int
    var Par: Int
    var Handicap: Int
    var Yardage: Int
}

///////////////////////////////////
//  This will fail to build and put xcode in an infinite indexing loop
//  The error is on the 3 occurances of     ...   Text(parsclass.yardageFront9)
///////////////////////////////////
private struct YardageView: View {
    @Binding var parsclass: parsClass

    var body: some View {
        HStack(spacing: 0) {
            Text("Yards").frame(width: holeDimensions().titleColumnWidth)
            ForEach(0..<parsclass.pars.count) { (hole) in
                if hole == 9 {
                    Text(parsclass.yardageFront9)
                        .holeX2Style()
                        .font(.system(size: 11.0))
                }
                Text(verbatim: String(parsclass.pars[hole].Yardage))
                    .foregroundColor(.white)
                    .holeStyle()
                    .font(.system(size: 8.0))
            }

            Text(parsclass.yardageBack9)
                .holeX2Style()
                .font(.system(size: 11.0))
            Text(parsclass.yardageBack18)
                .holeX2Style()
                .font(.system(size: 11.0))
        }
    }
}

///////////////////////////////////
// Fixed  Text("\(parsclass.yardageFront9)")  this occurs 3 times and everything is fine
//  if only one is done in error, the error is caught correctly
//  I think if two are done in error, the error is a bad view or something like that, please submit a bug report
//  When 3 are defined in error, xcode goes into the indexing forever
///////////////////////////////////
HStack(spacing: 0) {
            Text("Yards").frame(width: holeDimensions().titleColumnWidth)
            ForEach(0..<parsclass.pars.count) { (hole) in
                if hole == 9 {
                    Text("\(parsclass.yardageFront9)")
                        .holeX2Style()
                        .font(.system(size: 11.0))
                }
                Text(verbatim: String(parsclass.pars[hole].Yardage))
                    .foregroundColor(.white)
                    .holeStyle()
                    .font(.system(size: 8.0))
            }

            Text("\(parsclass.yardageBack9)")
                .holeX2Style()
                .font(.system(size: 11.0))
            Text("\(parsclass.yardageBack18)")
                .holeX2Style()
                .font(.system(size: 11.0))
        }

3      

You could try https://developer.apple.com/bug-reporting/ as a starting point.

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.