[CatNap, Chapter 9] The physics body of the bed doesn't show

Hi, everyone. As said in the title, after I added a physics body to the bed node and set the view to show physics, there was no green box shown on simulator and the wooden block that was supposed to be pushed aside was in its original position. Did anyone have the same problem? Thanks!

// in BedNode.swift
let bedBodySize = CGSize(width: 40.0, height: 30.0)
    physicsBody = SKPhysicsBody(rectangleOf: bedBodySize)
    physicsBody!.isDynamic = false

// in GameViewController.swift
view.showsPhysics = true

Problem solved.

In GameScene.swift, instead of explicit argument names, I used $0 in the following closure, which very unintuitively, represents the whole tuple of parameters when no other shorthand argument names are used.

enumerateChildNodes(withName: "//*") {
  if let node = $0 as? EventListenerNode {
    node.didMoveToScene()
  }
}

A lesson learned!

I am having the same problem! When the cat falls on the bed there is no collision, only with the edge! I am using Xcode 11.2 and Catalina OS X. I tried the code above and it doesn’t work, I get this error:

Contextual closure type ‘(SKNode, UnsafeMutablePointer) → Void’ expects 2 arguments, but 1 was used in closure body

very annoying trying to figure out the solution it takes so long. I just want to complete the book to make a 2d game for iOS!!!

@game_gecko Do you still have issues with this?