Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swiftui play mp3

import AVFoundation

var bombSoundEffect: AVAudioPlayer?
let path = Bundle.main.path(forResource: "example.mp3", ofType:nil)!
let url = URL(fileURLWithPath: path)

do {
    bombSoundEffect = try AVAudioPlayer(contentsOf: url)
    bombSoundEffect?.play()
} catch {
    // couldn't load file :(
}
Comment

PREVIOUS NEXT
Code Example
Swift :: swiftui textfield multiline 
Swift :: swift dispatch after 
Swift :: swiftui text field 
Swift :: how to get current shown collectionview cell index in swift 
Swift :: hide status bar in tableview cell in swift 
Swift :: swiftui full screen sheet 
Swift :: swift set uicolor 
Swift :: swift do while 
Swift :: create dictionary swift 
Swift :: swiftui scrollview 
Swift :: tuple swift 
Swift :: convert int to string in swift 
Swift :: go to view controller programmatically swift 
Swift :: loop backwards swift 
Swift :: swift change label text 
Swift :: swift screenshot 
Swift :: swiftui change form section color 
Swift :: swift programmatically set font 
Swift :: remove and element from array firebase swift 5 
Swift :: swift string 
Swift :: swift int to int32 
Swift :: swift lazy 
Swift :: The Swift pod `qr_code_scanner` depends upon `MTBBarcodeScanner`, which does not define modules 
Swift :: repeat...while Loop Swift 
Swift :: Swift Symmetric Difference between Two Sets 
Swift :: async await apis for ios 13 
Swift :: Swift Create enum variables 
Swift :: Swift Arithmetic Operators 
Swift :: Swift Find Number of Set Elements 
Swift :: swift isMemberOf 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =