1

There are a lot of questions and answers belonging how to read the contents of a directory. Unfortunatly none of them I get to work with Swift 3.0. Is there any update, which is running right now?

(Most of them get errors by the compiler and if I correct everything the way the compiler sugguested, I get a runtime error later on!) :-(

Reference to linked solution: This does not show any sub folder files like "while let url = enumerator.nextObject() as? URL" did. Is the headline misleading or do I need different function or additional parameters?

  • 1
    Thank you, I didn't see the update. Looks like what I searched for! –  Sep 15 '16 at 08:13
  • This does not show any sub folder files like "while let url = enumerator.nextObject() as? URL" did. Is the headline misleading or do I need different function or additional parameters? –  Sep 15 '16 at 09:15
  • I could not paste the code I used, bc. it is marked as duplicate (which is not). Send me a note and I send you the code. Main part is: let directoryEnumerator = FileManager().enumerator(at: directoryURL, includingPropertiesForKeys: resourceKeys, options: [.skipsHiddenFiles], errorHandler: nil)! for case let fileURL as NSURL in directoryEnumerator { guard let resourceValues = try? fileURL.resourceValues(forKeys: resourceKeys), let isDirectory = resourceValues[URLResourceKey.isDirectoryKey] as? Bool else { continue } – Peter71 Sep 15 '16 at 10:32

0 Answers0