From fdec40a873c1f40aaee7325270dd1e4a88571b3d Mon Sep 17 00:00:00 2001 From: iamai Date: Thu, 25 Nov 2021 17:21:38 +0500 Subject: [PATCH 1/2] add objC --- FileBrowser/FBFile.swift | 8 ++++---- FileBrowser/FileBrowser.swift | 8 ++++---- FileBrowser/FileListViewController.swift | 4 ++++ FileBrowser/FileParser.swift | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/FileBrowser/FBFile.swift b/FileBrowser/FBFile.swift index ff3869d..c25206c 100644 --- a/FileBrowser/FBFile.swift +++ b/FileBrowser/FBFile.swift @@ -13,13 +13,13 @@ import Foundation /// Display name. String. @objc open let displayName: String // is Directory. Bool. - open let isDirectory: Bool + @objc open let isDirectory: Bool /// File extension. - open let fileExtension: String? + @objc open let fileExtension: String? /// File attributes (including size, creation date etc). - open let fileAttributes: NSDictionary? + @objc open let fileAttributes: NSDictionary? /// NSURL file path. - open let filePath: URL + @objc open let filePath: URL // FBFileType open let type: FBFileType diff --git a/FileBrowser/FileBrowser.swift b/FileBrowser/FileBrowser.swift index aad61e3..7e00d83 100644 --- a/FileBrowser/FileBrowser.swift +++ b/FileBrowser/FileBrowser.swift @@ -9,21 +9,21 @@ import Foundation /// File browser containing navigation controller. -open class FileBrowser: UINavigationController { +@objc open class FileBrowser: UINavigationController { let parser = FileParser.sharedInstance var fileList: FileListViewController? /// File types to exclude from the file browser. - open var excludesFileExtensions: [String]? { + @objc open var excludesFileExtensions: [String]? { didSet { parser.excludesFileExtensions = excludesFileExtensions } } /// File paths to exclude from the file browser. - open var excludesFilepaths: [URL]? { + @objc open var excludesFilepaths: [URL]? { didSet { parser.excludesFilepaths = excludesFilepaths } @@ -48,7 +48,7 @@ open class FileBrowser: UINavigationController { /// - initialPath: NSURL filepath to containing directory. /// - allowEditing: Whether to allow editing. /// - showCancelButton: Whether to show the cancel button. - public convenience init(initialPath: URL? = nil, allowEditing: Bool = false, showCancelButton: Bool = true) { + @objc public convenience init(initialPath: URL? = nil, allowEditing: Bool = false, showCancelButton: Bool = true) { let validInitialPath = initialPath ?? FileParser.sharedInstance.documentsURL() diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index 936a9bd..9f7e586 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -98,6 +98,10 @@ class FileListViewController: UIViewController { self.navigationController?.isNavigationBarHidden = false } + @objc func close() { + navigationController?.popViewController(animated: true) + } + @objc func dismiss(button: UIBarButtonItem = UIBarButtonItem()) { self.dismiss(animated: true, completion: nil) } diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index c0e364f..20cf68b 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -8,7 +8,7 @@ import Foundation -class FileParser { +@objc class FileParser: NSObject { static let sharedInstance = FileParser() From ca6bca89e25d4c357738753776a7d9b67848c0cf Mon Sep 17 00:00:00 2001 From: iamai Date: Thu, 25 Nov 2021 17:48:23 +0500 Subject: [PATCH 2/2] add objC --- FileBrowser/FileBrowser.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FileBrowser/FileBrowser.swift b/FileBrowser/FileBrowser.swift index 7e00d83..df84372 100644 --- a/FileBrowser/FileBrowser.swift +++ b/FileBrowser/FileBrowser.swift @@ -30,7 +30,7 @@ import Foundation } /// Override default preview and actionsheet behaviour in favour of custom file handling. - open var didSelectFile: ((FBFile) -> ())? { + @objc open var didSelectFile: ((FBFile) -> ())? { didSet { fileList?.didSelectFile = didSelectFile }