Created
July 10, 2019 06:29
-
-
Save richo/be54f285572f48dc0ae31dd0390eb46c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// test | |
// | |
// Created by richö butts on 7/8/19. | |
// Copyright © 2019 richö butts. All rights reserved. | |
// | |
import UIKit | |
import MobileCoreServices | |
class ViewController: UIViewController , UIDocumentPickerDelegate { | |
@IBAction func BUTTAN(_ sender: Any) { | |
let importMenu = UIDocumentPickerViewController(documentTypes: [String(kUTTypeText)], in: .open) | |
importMenu.delegate = self | |
importMenu.modalPresentationStyle = .formSheet | |
print("Presenting the thing") | |
self.present(importMenu, animated: false, completion: nil) | |
print("Presented the thing") | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. | |
} | |
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { | |
guard let myURL = urls.first else { | |
return | |
} | |
print("import result : \(myURL)") | |
} | |
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) { | |
print("view was cancelled") | |
dismiss(animated: true, completion: nil) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment