Some problems in Chapter 9: Intermediate Physics, Swift 3

I got some problems with chapter 9. Page 209
I added code

    enumerateChildNodes(withName: "//*", using: { node, _ in
        if let eventListenerNode = node as? EventListenerNode {

when i build no any message come. Same with CatNode.


doesn’t work .

i check for mistakes in my code.
Also I open downloaded chapter 9 start project and cop-paste all text from this chapter - no any changes.
Anybody can download start project from chapter 9 and follow book till this scale code? Is it working or not? it takes only 2-3 minutes. I have feeling that there some problem with new Xcode.

Hi. I went through the first part of this chapter with the starter project and at first I did not see the print messages either.

My issue was that in GameScene.sks file, setting the Custom Class of the bed node to BedNode did not properly save. (Same for the CatNode.) I believe this is an issue with the Xcode scene editor in that it does not always properly pick up this change. Please go to GameScene.sks and make sure these values were saved. If not, enter it again, tab out, and Command-S.

This could be the cause of both of the issues that you are seeing.

Also, Xcode 8 seems to output some extra debug messages in the debug console. Narrow down the messages by using the search input (ex: “added to scene”).

Yes, i found same problem with saving. And I forced Xcode to save custom class in Scene editor. But still - Xcode doesn’t wont to use custom class. And without custom class this chapter can’t be done. I didn’t find the way how to fix or bypass this. Look like this is Xcode bugs

Hmm, if it’s still not saving, maybe try this:
After typing in the Custom Class again, tab out,and switch to the Attributes Inspector.
Then change the Name of the node and tab out.
Then change the name back to what it should be, tab out, and save.

For some reason Xcode doesn’t seem to pick up when the Custom Class value is changed. The file needs to be marked as changed (indicated by a darkened file icon in the project navigator) before it will successfully save. Modifying the node name should trigger the file to be marked as changed, and then allow for a successful save.

If this is a known issue with xcode, would it be a work around to conform the custom nodes to the procol and try to cast the specifc nodes as their classes instead of if let casting them as the protocol? My problem was that I was enumerating through all the nodes and the cast was failing so the method never fired.

haven’t read further into the chapter than here, so maybe it’s out of the question.