I am following a beginner game tutorial online and I got to this point where I am linking a sound file to several buttons.
Here is the code for it:
let soundFilePath = NSBundle.mainBundle().pathForResource("1", ofType: "wav")
let soundFileURL = NSURL(fileIRLWithPath: soundFilePath!)
Unfortunately, "NSBundle" is highlighted red and it says "Replace NSBundle with Bundle". I did but then I get the "mainBundle" error and so on.
The tutorial I am following is using Xcode 7.3+ I am Using Xcode 8+ so I'm certain that's the problem. Is there a way I can rewrite the code so it works properly?
Thanks.
In Swift 3, try this: