English feliratok

← Play Audio - Intro to iOS App Development with Swift

Beágyazókód kérése
3 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. So it seems that the variable audioPlayer is defined within, and
  2. is local to this function viewDidLoad.
  3. And I'm trying to use it here, in the playSlowAudio function.
  4. To fix this, I can declare it as a global variable at the top here.
  5. And I can remove the initialization from within viewDidLoad.
  6. So the variable AudioPlayer is of type AVAudioPlayer.
  7. It's being declared here, initialized here, and used here.
  8. All right, let's run this project.
  9. I'll go to the second scene and then click on this button.
  10. >> My mama always said, life was like a box of chocolates.
  11. >> All right, we have sound.