Xcode Inference Warning

Inference Warning:
Pasted Graphic 1

Fix by setting Inference to “Default”
Pasted Graphic

Swift Detect Node Overlap

Detect if nodes overlap
if enemy.contains((car.position)) {
// code

Audio with Swift

Add audio delegate
Pasted Graphic 1
Create audioPlayer public variable
Pasted Graphic
Create music function
Pasted Graphic 2
To prevent below error on play, be sure Music0.m4a is added to Build Phases
Pasted Graphic 4
Pasted Graphic 3

Swift Nil Check

Useful Nil Name Check

// verify name not nil
if ((node.name?.isEmpty) != nil) {
// exclude already clicked items
// only player circle
if node.name == "player" {
// change node position
node.position = location

//turn off player gravity field
let player = childNodeWithName("player") as! SKShapeNode
player.physicsBody?.dynamic = false
player.physicsBody!.fieldBitMask = PhysicsCategory.player
player.physicsBody?.dynamic = true