Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions AttachmentHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ class AttachmentHandler: NSObject{
}))

actionSheet.addAction(UIAlertAction(title: Constants.file, style: .default, handler: { (action) -> Void in
self.documentPicker()
self.documentPicker(vc: vc)
}))

actionSheet.addAction(UIAlertAction(title: Constants.cancelBtnTitle, style: .cancel, handler: nil))

actionSheet.popoverPresentationController?.sourceView = vc.view
actionSheet.popoverPresentationController?.permittedArrowDirections = []
actionSheet.popoverPresentationController?.sourceRect = CGRect(x: vc.view.bounds.midX, y: vc.view.bounds.midY, width: 0, height: 0)

vc.present(actionSheet, animated: true, completion: nil)
}

Expand Down Expand Up @@ -174,8 +177,11 @@ class AttachmentHandler: NSObject{
}

//MARK: - FILE PICKER
func documentPicker(){
func documentPicker(vc: UIViewController){
let importMenu = UIDocumentMenuViewController(documentTypes: [String(kUTTypePDF)], in: .import)
importMenu.popoverPresentationController?.sourceView = vc.view
importMenu.popoverPresentationController?.permittedArrowDirections = []
importMenu.popoverPresentationController?.sourceRect = CGRect(x: vc.view.bounds.midX, y: vc.view.bounds.midY, width: 0, height: 0)
importMenu.delegate = self
importMenu.modalPresentationStyle = .formSheet
currentVC?.present(importMenu, animated: true, completion: nil)
Expand Down