Search code examples
iosswifticloud

List all files in an iCloud folder


I want to search a folder that exists in my iCloud Drive for files. How can I get the paths of all files inside an iCloud folder on an iOS device or on Mac (via Catalyst)?


Solution

    1. Check iCloud > iCloud Documents in Xcode project Signing & Capabilities.

    2. Then we need the user to allow access to the Folder. Follow the directions in the Apple Doc. It shows how to ask for permission to access a folder by selecting it via the UIDocumentPickerViewController . It also shows how to list all files in that iCloud folder (even files outside the app’s container) and save it for future access.