Learn Courses My Dashboard

Getting warning when toggling

Hi all, my app is doing better, but this message pops up when I hit the toggle. Any suggestions? Thanks.

2022-03-26 17:04:00.678382-0500 C++inSwiftUI[65183:14753038] invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.

Can you paste your code that is behind this toggle?

Paste your code in as text, rather than providing a screenshot.

To format the code nicely, place 3 back-ticks ``` on the line above your code and 3 back-ticks ``` on the line below your code. The 3 back-ticks must be the ONLY characters on the line. The back-tick character is located on the same keyboard key as the tilde character ~ (which is located below the Esc key). You can also highlight an entire code block and click the </> button on the toolbar to wrap the block for you.

This also makes it easier for anyone assisting as they can copy the code and carry out some testing.

Here’s the first part of the view. If that isn’t sufficient, please let me know.


struct Base: View {
    let solution = String(cString: solveSudoku())
    let original = String(cString: getOriginal())
    
    @State var ss = true    // show solution
    var body: some View {
        VStack {
            Text("SUDOKU")
            Toggle("Show Solution", isOn: $ss)
                .padding(.all, 42)
            VStack {
                Spacer()
                HStack {
                    Spacer()
                    HStack {
                        dButton(n: 0, solution: solution, original: original, ss: ss).tag(0)
                        dButton(n: 1, solution: solution, original: original, ss: ss).tag(1)
                        dButton(n: 2, solution: solution, original: original, ss: ss).tag(2)
                    }

It looks fine, it is working?

Also you should name the variable showSolution Because ss is confusing and then there would be no need for the comment show solution