1

I have a file stored in the documents folder of my application, and it's accessible through the Files App under {my_app_name}/my_file.txt.

The file is accessible and modifiable by other applications. When I select the file in the Files app I want the file to be previewed with a QLPreviewController(), and ultimately give the user specific options to handle that file.

When the file is selected the URL gets passed to:

func application(_ app: UIApplication, open inputURL: URL, options: 
      [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
      // Here I'm trying to push my preview of the file
}

I can't figure out what to do within this method, as I'm not too experienced with iOS development. Hopefully someone can point me in the right direction, Thanks!

On startup, my application uses a UITabBarController as it's rootViewController:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: 
      [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    let tabBarController = UITabBarController()   
    let tabViewController1 = MainViewController()

    let navigationController1 = UINavigationController(rootViewController: tabViewController1)
    let controllers = [navigationController1, ...]

    ...

    window?.rootViewController = tabBarController
    window?.makeKeyAndVisible()

}

0 Answers0