1

Currently I have my files in an array as URLs:

var cafFilesArray: [NSURL] {
    return (NSFileManager.defaultManager().contentsOfDirectoryAtURL(documentsDirectoryURL, includingPropertiesForKeys: nil, options: .SkipsHiddenFiles | .SkipsSubdirectoryDescendants | .SkipsPackageDescendants, error: nil) as! [NSURL]).sorted{$0.lastPathComponent<$1.lastPathComponent}.filter{$0.pathExtension!.lowercaseString == "caf"}

How do I convert an array of URLs to Strings so I can display them in a tableview.

Thanks.

phaggio
  • 23
  • 4
  • `NSURL` has a `absoluteString` property – Azat Apr 29 '15 at 07:26
  • What have you tried so far? Related: [Converting URL to String and back again](http://stackoverflow.com/questions/27062454/converting-url-to-string-and-back-again). – mins Apr 29 '15 at 07:28
  • also look at NSURL lastpAthComponent method which Lismore convenient for displaying file names (not the path!) in a table view – Volker Apr 29 '15 at 07:32
  • Thank you. The absoluteString works. – phaggio May 09 '15 at 18:11

1 Answers1

0

Loop through the NSURL array and do myurl.absoluteString to convert each element to a string and then append it to an array.

EmirC
  • 161
  • 6