Skip to content

Instantly share code, notes, and snippets.

@cliff538
cliff538 / PlaySoundSwiftXcode.txt
Last active April 24, 2019 14:22
Simple sound playing code built in Swift 4 / Xcode 9.
import UIKit
import AVFoundation
class ViewController: UIViewController, AVAudioPlayerDelegate {
// MARK: - Properties
var audioPlayer : AVAudioPlayer!
let soundArray = ["note1", "note2", "note3", "note4", "note5", "note6", "note7"]