Join Simon Allardice for an in-depth discussion in this video Finding all files, part of Code Clinic: Swift.
- View Offline
- Exercise Files
- In other code clinics and other programming languages,…I would have to talk a lot about recursion…to solve this problem.…Because if we have an unknown folder structure…where we don't know how many levels it goes down,…we would typically search this…by writing some recursive code,…having a function that can repeatedly call itself…to handle multiple levels of nesting.…I have some pseudocode here.…So we call some search directory function…passing the name of the top folder,…and then go through that checking each item…inside that folder.…And if that item is itself a subfolder, a directory,…we would call the same function,…passing in that subfolder name.…
We would drop into that folder, process…each item inside it.…If any of those are subfolders,…we would call the function again,…et cetera, et cetera, until we've gone down…all of the levels and all of the items are checked.…But for us, this ain't a problem.…Because in Swift or Objective-C,…if we want to find every file in a directory,…even if that directory has multiple levels…
Simon introduces challenges and then provides an overview of his solutions in Swift. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Skill Level Intermediate
1. Problem One: Exploring Lake Pend Oreille
2. Problem Two: Image Analysis
3. Problem 3: Eight Queens
4. Problem 4 - Accessing Peripherals
5. Problem 5 - Recursion and Directories
6. Problem 6 - Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.