将文件扩展名添加到 iOS 文档管理器

Adding file extensions to iOS document manager

我正在为 Swift 应用程序使用默认的 iOS 文件管理器。我正在为 UIDocumentBrowserViewController 编写 class,我希望显示整个文件名。例如,我想要 Untitled.txt 而不是无题。或者不是脚本,script.py。

附带说明一下,我注意到实际的文件应用程序没有显示扩展名的功能。

有时候检查苹果文档是值得的)https://developer.apple.com/documentation/uikit/uidocumentbrowserviewcontroller

据我所知,在 UIDocumentBrowserViewController 的 var shouldShowFileExtensions: Bool 的帮助下,可以显示文件的扩展名。但令我们遗憾的是,它仅适用于 iOS 13.0+.

正如 Apple 所说的那样 属性 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.