Unfortunately, what @KnightOfDragon says is wrong (but I don't have enough reputation for comments).
SKAudioNodewas introduced in iOS 9 and is intended to be replaced SKAction.playSoundFileNamed(...)because it is much more powerful (you can add it as a child in SpriteKit SKNode, and if the attribute positionalis set to true, adding 3D sound is automatically added).
SKAudioNode, :
if #available(iOS 9, *) {
let pling = SKAudioNode(fileNamed: "pling.wav")
pling.autoplayLooped = false
someNode.addChild(pling)
someNode.runAction(SKAction.sequence([
SKAction.waitForDuration(0.5),
SKAction.runBlock {
pling.runAction(SKAction.play())
}
])
}
else {
}
Update
, : SKAction- > Audio-Stuff. :
SKAction playSoundFileNamed: waitForCompletion: . AVAudioPlayer .
, , a SKAudioNode . playSoundFileNamed / ..