iOS Foundations - Module 4 - Lesson 6

Hello - My name is Karla Vohra and I am taking the iOS Foundations course. I am currently working on Module 4 and the challenge for Lesson 6. My code is different from the solution provided. Instead of creating an array for People in the Model.swift file, I created a JSON file called Persons and parsed the data and then created the list and the toggle views. My solution works but I am getting the following in the debug console and I am not sure what it means?

Below is the GitHub link to my code:

Any help would be greatly appreciated.

M4_L6_EnvironmentObject_Challenge_v01[51747:7786282] invalid mode ‘kCFRunLoopCommonModes’ provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.

Regards
Karla

Hi Karla,

I just downloaded your project and I noticed that the iOS Deployment Target was blank so added that on this screen:

I also injected the Observable Object into two of the Previews using .environmentObject() modifier so that I could get them to work. Like this:

struct PersonListView_Previews: PreviewProvider {
    static var previews: some View {
        PersonListView()
            .environmentObject(PersonModel())
    }
}

and

struct PersonSelectionView_Previews: PreviewProvider {
    static var previews: some View {
        PersonSelectionView()
            .environmentObject(PersonModel())
    }
}

I ran the code on my selected iPhone Simulator and I don’t get the error you are experiencing and your code works perfectly. Well done.

Hello Chris - Thank you for responding so quickly. I added the Observable Object into the two Previews using .enviornmentObject() modifier as well. Also, I made sure that the iOS Deployment target is set. I set mine to 15.5. However, I still get the same error message in the debug console.

The error message happens when I use the toggles to turn one or more of the items off. For example, when I go to the second tab and turn off Years of Experience, that is when I get the message. The toggle works because on the PersonListView the Years of Experience does not show if the showExperience property is false, but the error message is there. Not sure why.

I uploaded a more recent version of the code with the changes you recommended onto GitHub

Thank you again for all your help.

Regards,
Karla

OK so you must have Xcode 13.4 installed. I only have Xcode 13.3.1

Given that being the case, there is probably something about the later version of Xcode giving you that error/warning message.

I was reading some comments on the Apple forums and from what I can see it’s nothing to worry about. It appears to be a bug in UIKit which SwiftUI interfaces in the background so take no notice.

Awesome…Thank you very much for all your help.

Regards,
Karla