1
, Ich möchte wissen, was ist das Äquivalent von Swift 3Was ist die swift 2 entspricht der schnellen 3 "String enthält" -Funktion? Hallo von npn.dev
mySong.contains
für Swift 2 auf Xcode 7 (weil ich es will Erstellen Sie eine Anwendung für iPhone 4). Entschuldigen Sie mich für mein Englisch, weil ich bin französisch ... und Google Übersetzung helfen mir
Mein Code:
func gettingSongName(){
let folderURL = NSURL(fileURLWithPath: NSBundle.mainBundle().resourcePath!)
do{
let songPath = try NSFileManager.defaultManager().contentsOfDirectoryAtURL(folderURL, includingPropertiesForKeys: nil, options: .SkipsHiddenFiles)
for song in songPath{
var mySong = song.absoluteString
if mySong.contains(".mp3") { // Value of type 'String' has no member 'contains'
let findString = mySong.components(separatedBy: "/") // Value of type 'String' has no member 'components'
mySong = findString[findString.count-1]
mySong = mySong.replacingOccurrences(of: "%20", with: " ") // Value of type 'String' has no member 'replacingOccurences'
mySong = mySong.replacingOccurrences(of: "e%CC%81", with: "é") // Value of type 'String' has no member 'replacingOccurences'
mySong = mySong.replacingOccurrences(of: "e%CC%82", with: "ê") // Value of type 'String' has no member 'replacingOccurences'
mySong = mySong.replacingOccurrences(of: ".mp3", with: "") // Value of type 'String' has no member 'replacingOccurences'
songs.append(mySong)
print(mySong)
}
}
myTableView.reloadData()
}catch{
}
}
danken Ihnen im Voraus, npn.dev
danke, ich werde versuchen –
Ich verstehe nicht @Pal Singh Anand –
was Sie nicht verstehen, bro? –