NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

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))
        }

   

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

   

Hacking with Swift is sponsored by Instabug

SPONSORED Catch bugs as soon as they happen and know exactly why a crash occurred. Instabug's SDK grabs all the logs they need to fix bugs, crashes and performance issues in minutes instead of days. Get screenshots, device details, network logs, repro steps, and tons of other critical insights needed to resolve issues and prioritize product backlogs straight from your dashboard. It only takes a minute to integrate!

Get started now

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

Reply to this topic…

You need to create an account or log in to reply.

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.