This code gives an error 'pathExtension' is unavailable: Use pathExtension on URL instead:
if originalAudioFormat == "MP2" || originalAudioFormat == "BWFMP2" {
SourceFileNameWithPath = decodeMp2ToWav()
if SourceFileNameWithPath.pathExtension != "wav" { //error at this line
print("save File as PCM Fehler: \(SourceFileNameWithPath)")
return
}
Basically it's highly recommended to prefer always URL
s to String
paths.
Alternatively you can bridge the string to NSString
(SourceFileNameWithPath as NSString).pathExtension
Please conform to the naming convention that variable names start with a lowercase letter.