I am new to Swift programming and I am trying to iterate files in a folder. I looked at the answer here and tried to translate it into Swift syntax, but failed.
let fileManager = NSFileManager.defaultManager() let enumerator:NSDirectoryEnumerator = fileManager.enumeratorAtPath(folderPath) for element in enumerator { //do something }
I get an error:
Type 'NSDirectoryEnumerator' does not conform to protocol 'SequenceType'
My goal is to look at all the subfolders and files contained in the main folder, and find all the files with a specific extension, then to do something with them.
cocoa swift nsfilemanager
Iacopo Boccalari Aug 13 '14 at 11:31 2014-08-13 11:31
source share