Skip to main content

Command Palette

Search for a command to run...

Make your app's files user-visible on the iPhone

Updated
1 min read
Make your app's files user-visible on the iPhone

In this blog post, I will show how you can ensure the user can access your app's files in the Documents directory through other services like Spotlight or the Files app.

Store local files in the Documents directory of your app's container when you intend to make those files user-visible.

try? "Hello, world!".write(to: URL.documentsDirectory.appending(path: "Demo.txt"), atomically: true, encoding: .utf8)

Per default, files in your app's Documents directory will not be accessible in the iPhone's Files app.

No Files

Your app needs to support "Open in Place" and indicates that file sharing is enabled, both configured in your Info.plist file by adding the following property list keys:

Info.plist screenshots with UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace

    <key>UIFileSharingEnabled</key>
    <true/>
    <key>LSSupportsOpeningDocumentsInPlace</key>
    <true/>

Files app can show them now in the "On My iPhone" or "On My iPad" location.

Folder shown in Files App

File shown in Files App

People can also find their files in Spotlight and on iPad, drag and drop them to other apps.

A summary on YouTube is available:

More from this blog

Dev blog post potpourri by senior software engineer Marco Eidinger

149 posts

Hello 👋🏻 , I am a Software Engineer working on open source and enterprise mobile SDKs for iOS and MacOS developers written in Swift. From 🇩🇪 and happily living in 🇺🇸