Iterate through files in a folder and its subfolders using Swift’s FileManager. Use the nextObject() method of enumerator:
1 2 3 4 | while let element = enumerator?.nextObject() as? String { if element.hasSuffix("ext") { // checks the extension } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.