2

I’m using the default iOS file manager for a Swift application. I’m writing the class for a UIDocumentBrowserViewController and I want the whole file name to show. For example rather than Untitled, I want Untitled.txt. Or rather than script, script.py.

As a side note, I notice that the actual files app does not have functionality to show the extension.

Matt Bart
  • 809
  • 1
  • 7
  • 26

1 Answers1

2

Sometimes its worth to check apple documentation) https://developer.apple.com/documentation/uikit/uidocumentbrowserviewcontroller

As I see it is possible to show file's extension, with help of var shouldShowFileExtensions: Bool from UIDocumentBrowserViewController. But to our sorrow it's available only from iOS 13.0+.

And as Apple says about this property https://developer.apple.com/documentation/uikit/uidocumentbrowserviewcontroller/3153159-shouldshowfileextensions

The default value is false.

This property has no effect in iPad apps running in macOS.

Community
  • 1
  • 1
Andrew
  • 471
  • 3
  • 13
  • I appreciate it. I saw nothing online because it is still in beta. And I looked through the documentation, but the current one (not the beta one). Cheers – Matt Bart Jul 07 '19 at 23:44
  • 5
    This is all nice to read, but in practice it doesn't do anything. Adding `.shouldShowFileExtensions = true` still doesn't show filenames. So frustrating. Why would anyone NOT want to show filenames is beyond my imagination... It just adds confusion. – lenooh Oct 06 '19 at 16:30