Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

LegendaryW33nie

macrumors newbie
Original poster
Mar 4, 2014
7
0
Hello,

I am trying to develop a soundboard application for iOS and have been getting myself familiar with xCode and Swift for around 2 months now. I've just started to create my own application and have come across a little problem. From the image below, I believe all my code is correctly referenced right now I just don't know how to play the sound when the button is tapped. Any help is appreciated.

Thanks,

(Go easy on me if it looks really bad, I'm new :))
 

Attachments

  • Screen Shot 2015-04-04 at 10.05.05 PM.png
    Screen Shot 2015-04-04 at 10.05.05 PM.png
    96.3 KB · Views: 175
Your button method is empty i.e.
Code:
@IBAction func introTapped(sender: UIButton ) {
[COLOR="Red"]You need some code here to play the sound[/COLOR] 
}
 
Your button method is empty i.e.
Code:
@IBAction func introTapped(sender: UIButton ) {
[COLOR="Red"]You need some code here to play the sound[/COLOR] 
}

What kind of code would I put there though? I have tried something like

Code:
if (self.flipSoundPlayer != nil) {
    self.flipSoundPlayer?.play()
}

but that doesn't work, no sound plays at all. I don't know the right format to put there to get the sound to play
 
Last edited by a moderator:
What kind of code would I put there though? I have tried something like

Code:
if (self.flipSoundPlayer != nil) {
    self.flipSoundPlayer?.play()
}

but that doesn't work, no sound plays at all. I don't know the right format to put there to get the sound to play

What is self.flipSoundPlayer ? According to your first attachment shouldn't that be self.intro?
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.