From 42f0f6179ff956c5e7b8df24aec3d24f1845e531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Wed, 28 Dec 2016 20:20:20 +0100 Subject: [PATCH 01/36] Add dataSource protocol to allow using custom file systems --- FileBrowser.xcodeproj/project.pbxproj | 10 ++- FileBrowser/FBFile.swift | 25 ++---- FileBrowser/FileBrowser.swift | 47 +++++++---- FileBrowser/FileBrowserDataSource.swift | 28 +++++++ FileBrowser/FileListPreview.swift | 2 +- FileBrowser/FileListTableView.swift | 4 +- FileBrowser/FileListViewController.swift | 22 ++++-- FileBrowser/FileParser.swift | 78 ++++++++++--------- FileBrowser/PreviewManager.swift | 17 ++-- FileBrowser/WebviewPreviewViewContoller.swift | 6 +- 10 files changed, 147 insertions(+), 92 deletions(-) create mode 100644 FileBrowser/FileBrowserDataSource.swift diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 3fb59b7..9939ab4 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -33,6 +33,7 @@ 349A12361C707E86005435C0 /* image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A122F1C707E86005435C0 /* image@2x.png */; }; 349A12371C707E86005435C0 /* pdf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* pdf@2x.png */; }; 349A12381C707E86005435C0 /* zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* zip@2x.png */; }; + C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -46,11 +47,11 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListViewController.swift; sourceTree = ""; }; + 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 3439AB671C6F203A0058AF04 /* FileParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileParser.swift; sourceTree = ""; }; 3439AB691C6FC6D90058AF04 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; }; 3439AB6B1C6FD6650058AF04 /* FileListPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListPreview.swift; sourceTree = ""; }; - 3439AB6F1C6FF68C0058AF04 /* FileBrowser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowser.swift; sourceTree = ""; }; + 3439AB6F1C6FF68C0058AF04 /* FileBrowser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileBrowser.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 343C44611C73CC8100D874FB /* PreviewTransitionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewTransitionViewController.swift; sourceTree = ""; }; 343C44651C73CD3200D874FB /* PreviewManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewManager.swift; sourceTree = ""; }; 343C44671C73CD8700D874FB /* PreviewTransitionViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreviewTransitionViewController.xib; sourceTree = ""; }; @@ -66,7 +67,7 @@ 3441DC601C71235C005CC2FA /* 3crBXeO.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = 3crBXeO.gif; sourceTree = ""; }; 3441DC621C712370005CC2FA /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; 349A12231C70725D005435C0 /* FileListSearch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListSearch.swift; sourceTree = ""; }; - 349A12251C707317005435C0 /* FileListTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListTableView.swift; sourceTree = ""; }; + 349A12251C707317005435C0 /* FileListTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListTableView.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 349A12271C707B1A005435C0 /* FBFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FBFile.swift; sourceTree = ""; }; 349A122B1C707E86005435C0 /* documents@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "documents@2x.png"; sourceTree = ""; }; 349A122C1C707E86005435C0 /* file@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "file@2x.png"; sourceTree = ""; }; @@ -75,6 +76,7 @@ 349A122F1C707E86005435C0 /* image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image@2x.png"; sourceTree = ""; }; 349A12301C707E86005435C0 /* pdf@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pdf@2x.png"; sourceTree = ""; }; 349A12311C707E86005435C0 /* zip@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zip@2x.png"; sourceTree = ""; }; + C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -103,6 +105,7 @@ children = ( 3439AB671C6F203A0058AF04 /* FileParser.swift */, 349A12271C707B1A005435C0 /* FBFile.swift */, + C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */, ); name = Data; sourceTree = ""; @@ -326,6 +329,7 @@ 3439AB681C6F203A0058AF04 /* FileParser.swift in Sources */, 349A12281C707B1A005435C0 /* FBFile.swift in Sources */, 343C44631C73CC8100D874FB /* PreviewTransitionViewController.swift in Sources */, + C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */, 3437405B1C6E7DA50090FD6A /* FileListViewController.swift in Sources */, 349A12241C70725D005435C0 /* FileListSearch.swift in Sources */, 3439AB6C1C6FD6650058AF04 /* FileListPreview.swift in Sources */, diff --git a/FileBrowser/FBFile.swift b/FileBrowser/FBFile.swift index 6e8c700..fb460c0 100644 --- a/FileBrowser/FBFile.swift +++ b/FileBrowser/FBFile.swift @@ -17,7 +17,7 @@ open class FBFile: NSObject { /// File extension. open let fileExtension: String? /// File attributes (including size, creation date etc). - open let fileAttributes: NSDictionary? + //open let fileAttributes: NSDictionary? = nil /// NSURL file path. open let filePath: URL // FBFileType @@ -30,17 +30,15 @@ open class FBFile: NSObject { - returns: FBFile object. */ - init(filePath: URL) { + public init(filePath: URL) { self.filePath = filePath - let isDirectory = checkDirectory(filePath) - self.isDirectory = isDirectory + self.isDirectory = checkDirectory(filePath) + if self.isDirectory { - self.fileAttributes = nil self.fileExtension = nil self.type = .Directory } else { - self.fileAttributes = getFileAttributes(self.filePath) self.fileExtension = filePath.pathExtension if let fileExtension = fileExtension { self.type = FBFileType(rawValue: fileExtension) ?? .Default @@ -82,7 +80,7 @@ public enum FBFileType: String { - returns: UIImage for file type */ public func image() -> UIImage? { - let bundle = Bundle(for: FileParser.self) + let bundle = Bundle(for: FBFile.self) var fileName = String() switch self { case .Directory: fileName = "folder@2x.png" @@ -104,6 +102,9 @@ public enum FBFileType: String { - returns: isDirectory Bool. */ func checkDirectory(_ filePath: URL) -> Bool { + if #available(iOS 9.0, *) { + return filePath.hasDirectoryPath + } var isDirectory = false do { var resourceValue: AnyObject? @@ -115,13 +116,3 @@ func checkDirectory(_ filePath: URL) -> Bool { catch { } return isDirectory } - -func getFileAttributes(_ filePath: URL) -> NSDictionary? { - let path = filePath.path - let fileManager = FileParser.sharedInstance.fileManager - do { - let attributes = try fileManager.attributesOfItem(atPath: path) as NSDictionary - return attributes - } catch {} - return nil -} diff --git a/FileBrowser/FileBrowser.swift b/FileBrowser/FileBrowser.swift index 340183f..d1fae18 100644 --- a/FileBrowser/FileBrowser.swift +++ b/FileBrowser/FileBrowser.swift @@ -11,21 +11,28 @@ import Foundation /// File browser containing navigation controller. open class FileBrowser: UINavigationController { - let parser = FileParser.sharedInstance + open var dataSource: FileBrowserDataSource = LocalFileParser() var fileList: FileListViewController? /// File types to exclude from the file browser. open var excludesFileExtensions: [String]? { didSet { - parser.excludesFileExtensions = excludesFileExtensions + dataSource.excludesFileExtensions = excludesFileExtensions } } /// File paths to exclude from the file browser. open var excludesFilepaths: [URL]? { didSet { - parser.excludesFilepaths = excludesFilepaths + dataSource.excludesFilepaths = excludesFilepaths + } + } + + /// Whether to exclude files with empty filenames + open var excludesWithEmptyFilenames: Bool = false { + didSet { + dataSource.excludesWithEmptyFilenames = excludesWithEmptyFilenames } } @@ -37,28 +44,38 @@ open class FileBrowser: UINavigationController { } /** - Init to documents folder. - - - returns: File browser view controller. - */ + Init to local documents folder. + */ public convenience init() { - let parser = FileParser.sharedInstance - let path = parser.documentsURL() - self.init(initialPath: path as URL) + let parser = LocalFileParser() + self.init(dataSource: parser) } /** - Init to a custom directory path. + Init to a custom local directory path. - parameter initialPath: NSURL filepath to containing directory. - - - returns: File browser view controller. - */ + */ public convenience init(initialPath: URL) { - let fileListViewController = FileListViewController(initialPath: initialPath) + let parser = LocalFileParser() + parser.customRootUrl = initialPath + self.init(dataSource: parser) + } + + /** + Init with a custom dataSource. Alternatively, the dataSource can be set after initialization. + + - parameter parser: The data source used by the file browser + */ + + public convenience init(dataSource: FileBrowserDataSource) { + let fileListViewController = FileListViewController(dataSource: dataSource, withDirectory: dataSource.rootURL) self.init(rootViewController: fileListViewController) + self.dataSource = dataSource self.view.backgroundColor = UIColor.white self.fileList = fileListViewController } + + } diff --git a/FileBrowser/FileBrowserDataSource.swift b/FileBrowser/FileBrowserDataSource.swift new file mode 100644 index 0000000..2ecf8c4 --- /dev/null +++ b/FileBrowser/FileBrowserDataSource.swift @@ -0,0 +1,28 @@ +// +// FileBrowserDataSource.swift +// FileBrowser +// +// Created by Carl Julius Gödecken on 28/12/2016. +// Copyright © 2016 Carl Julius Gödecken. +// + +import Foundation + +public protocol FileBrowserDataSource { + var rootURL: URL { get } + func contents(ofDirectoryWithURL directoryURL: URL) throws -> [FBFile] + func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? + func data(forFile file: FBFile) throws -> Data + func dataURL(forFile file: FBFile) throws -> URL + + var excludesFileExtensions: [String]? { get set } + var excludesFilepaths: [URL]? { get set } + var excludesWithEmptyFilenames: Bool { get set } +} + +extension FileBrowserDataSource { + public func data(forFile file: FBFile) throws -> Data { + let url = try dataURL(forFile: file) + return try Data(contentsOf: url) + } +} diff --git a/FileBrowser/FileListPreview.swift b/FileBrowser/FileListPreview.swift index 240413d..d2bc8e9 100644 --- a/FileBrowser/FileListPreview.swift +++ b/FileBrowser/FileListPreview.swift @@ -27,7 +27,7 @@ extension FileListViewController: UIViewControllerPreviewingDelegate { let selectedFile = fileForIndexPath(indexPath) previewingContext.sourceRect = tableView.rectForRow(at: indexPath) if selectedFile.isDirectory == false { - return previewManager.previewViewControllerForFile(selectedFile, fromNavigation: false) + return previewManager.previewViewControllerForFile(selectedFile, dataSource: dataSource, fromNavigation: false) } } } diff --git a/FileBrowser/FileListTableView.swift b/FileBrowser/FileListTableView.swift index bb2a290..2e3832a 100644 --- a/FileBrowser/FileListTableView.swift +++ b/FileBrowser/FileListTableView.swift @@ -43,7 +43,7 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate { let selectedFile = fileForIndexPath(indexPath) searchController.isActive = false if selectedFile.isDirectory { - let fileListViewController = FileListViewController(initialPath: selectedFile.filePath) + let fileListViewController = FileListViewController(dataSource: dataSource, withDirectory: selectedFile.filePath) fileListViewController.didSelectFile = didSelectFile self.navigationController?.pushViewController(fileListViewController, animated: true) } @@ -53,7 +53,7 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate { didSelectFile(selectedFile) } else { - let filePreview = previewManager.previewViewControllerForFile(selectedFile, fromNavigation: true) + let filePreview = previewManager.previewViewControllerForFile(selectedFile, dataSource: dataSource, fromNavigation: true) self.navigationController?.pushViewController(filePreview, animated: true) } } diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index b898c5e..1a3b919 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -15,10 +15,11 @@ class FileListViewController: UIViewController { let collation = UILocalizedIndexedCollation.current() /// Data + var directoryPath: URL! + var dataSource: FileBrowserDataSource! + var didSelectFile: ((FBFile) -> ())? var files = [FBFile]() - var initialPath: URL? - let parser = FileParser.sharedInstance let previewManager = PreviewManager() var sections: [[FBFile]] = [] @@ -35,13 +36,15 @@ class FileListViewController: UIViewController { //MARK: Lifecycle - convenience init (initialPath: URL) { + convenience init (dataSource: FileBrowserDataSource, withDirectory directoryPath: URL) { self.init(nibName: "FileBrowser", bundle: Bundle(for: FileListViewController.self)) self.edgesForExtendedLayout = UIRectEdge() - // Set initial path - self.initialPath = initialPath - self.title = initialPath.lastPathComponent + // Set implicitly unwrapped optionals + self.dataSource = dataSource + self.directoryPath = directoryPath + + self.title = directoryPath.lastPathComponent // Set search controller delegates searchController.searchResultsUpdater = self @@ -67,9 +70,12 @@ class FileListViewController: UIViewController { override func viewDidLoad() { // Prepare data - if let initialPath = initialPath { - files = parser.filesForDirectory(initialPath) + do { + files = try dataSource.contents(ofDirectoryWithURL: self.directoryPath) indexFiles() + } catch let error { + // TODO: error handling + print(error.localizedDescription) } // Set search bar diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index c0e364f..5fe037c 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -8,57 +8,61 @@ import Foundation -class FileParser { +class LocalFileParser: FileBrowserDataSource { - static let sharedInstance = FileParser() + var excludesFileExtensions: [String]? = nil + var excludesFilepaths: [URL]? = nil + var excludesWithEmptyFilenames = false - var _excludesFileExtensions = [String]() - - /// Mapped for case insensitivity - var excludesFileExtensions: [String]? { - get { - return _excludesFileExtensions.map({$0.lowercased()}) - } - set { - if let newValue = newValue { - _excludesFileExtensions = newValue - } - } - } - - var excludesFilepaths: [URL]? let fileManager = FileManager.default - func documentsURL() -> URL { + var customRootUrl: URL? + var defaultRootUrl: URL { return fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL } - func filesForDirectory(_ directoryPath: URL) -> [FBFile] { - var files = [FBFile]() - var filePaths = [URL]() + var rootURL: URL { + return customRootUrl ?? defaultRootUrl + } + + func contents(ofDirectoryWithURL directoryURL: URL) throws -> [FBFile] { + // Get contents - do { - filePaths = try self.fileManager.contentsOfDirectory(at: directoryPath, includingPropertiesForKeys: [], options: [.skipsHiddenFiles]) - } catch { - return files + + let filePaths = try self.fileManager.contentsOfDirectory(at: directoryURL, includingPropertiesForKeys: [], options: [.skipsHiddenFiles]) + + // Filter + var files = filePaths.map(FBFile.init) + if let excludesFileExtensions = excludesFileExtensions { + let lowercased = excludesFileExtensions.map { $0.lowercased() } + files = files.filter { !lowercased.contains($0.fileExtension?.lowercased() ?? "") } } - // Parse - for filePath in filePaths { - let file = FBFile(filePath: filePath) - if let excludesFileExtensions = excludesFileExtensions, let fileExtensions = file.fileExtension , excludesFileExtensions.contains(fileExtensions) { - continue - } - if let excludesFilepaths = excludesFilepaths , excludesFilepaths.contains(file.filePath) { - continue - } - if file.displayName.isEmpty == false { - files.append(file) - } + if let excludesFilepaths = excludesFilepaths { + files = files.filter { !excludesFilepaths.contains($0.filePath) } } + if excludesWithEmptyFilenames { + files = files.filter { !$0.displayName.isEmpty } + } + // Sort files = files.sorted(){$0.displayName < $1.displayName} return files } + + func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? { + let path = fileUrl.path + do { + let attributes = try fileManager.attributesOfItem(atPath: path) as NSDictionary + return attributes + } catch { + return nil + } + } + + func dataURL(forFile file: FBFile) throws -> URL { + return file.filePath + } + } diff --git a/FileBrowser/PreviewManager.swift b/FileBrowser/PreviewManager.swift index 672283b..a340a58 100644 --- a/FileBrowser/PreviewManager.swift +++ b/FileBrowser/PreviewManager.swift @@ -11,20 +11,24 @@ import QuickLook class PreviewManager: NSObject, QLPreviewControllerDataSource { - var filePath: URL? + var file: FBFile? + var dataSource: FileBrowserDataSource? - func previewViewControllerForFile(_ file: FBFile, fromNavigation: Bool) -> UIViewController { + func previewViewControllerForFile(_ file: FBFile, dataSource: FileBrowserDataSource, fromNavigation: Bool) -> UIViewController { - if file.type == .PLIST || file.type == .JSON{ + if file.type == .PLIST || file.type == .JSON { let webviewPreviewViewContoller = WebviewPreviewViewContoller(nibName: "WebviewPreviewViewContoller", bundle: Bundle(for: WebviewPreviewViewContoller.self)) + webviewPreviewViewContoller.dataSource = dataSource webviewPreviewViewContoller.file = file return webviewPreviewViewContoller } else { let previewTransitionViewController = PreviewTransitionViewController(nibName: "PreviewTransitionViewController", bundle: Bundle(for: PreviewTransitionViewController.self)) + self.file = file + self.dataSource = dataSource + previewTransitionViewController.quickLookPreviewController.dataSource = self - self.filePath = file.filePath as URL if fromNavigation == true { return previewTransitionViewController.quickLookPreviewController } @@ -32,19 +36,18 @@ class PreviewManager: NSObject, QLPreviewControllerDataSource { } } - + // MARK: delegate methods func numberOfPreviewItems(in controller: QLPreviewController) -> Int { return 1 } func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { let item = PreviewItem() - if let filePath = filePath { + if let file = file, let filePath = try? dataSource?.dataURL(forFile: file) { item.filePath = filePath } return item } - } class PreviewItem: NSObject, QLPreviewItem { diff --git a/FileBrowser/WebviewPreviewViewContoller.swift b/FileBrowser/WebviewPreviewViewContoller.swift index 0c89067..a91e506 100644 --- a/FileBrowser/WebviewPreviewViewContoller.swift +++ b/FileBrowser/WebviewPreviewViewContoller.swift @@ -14,6 +14,7 @@ class WebviewPreviewViewContoller: UIViewController { var webView = WKWebView() + var dataSource: FileBrowserDataSource! var file: FBFile? { didSet { self.title = file?.displayName @@ -40,7 +41,8 @@ class WebviewPreviewViewContoller: UIViewController { //MARK: Share func shareFile() { - guard let file = file else { + guard let file = file, + let url = try? dataSource.dataURL(forFile: file) else { return } let activityViewController = UIActivityViewController(activityItems: [file.filePath], applicationActivities: nil) @@ -51,7 +53,7 @@ class WebviewPreviewViewContoller: UIViewController { //MARK: Processing func processForDisplay() { - guard let file = file, let data = try? Data(contentsOf: file.filePath as URL) else { + guard let file = file, let data = try? dataSource.data(forFile: file) else { return } var rawString: String? From 72e8559a1fe3fb600c6fdf39b757bdd99543b600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Wed, 28 Dec 2016 20:23:47 +0100 Subject: [PATCH 02/36] Add sample custom file browser --- .../Sample/Sample.xcodeproj/project.pbxproj | 8 +- .../xcshareddata/xcschemes/Sample.xcscheme | 2 +- .../Sample/Sample/Base.lproj/Main.storyboard | 19 ++++- examples/Sample/Sample/CustomDataSource.swift | 80 +++++++++++++++++++ .../View Controller/MainViewController.swift | 7 +- 5 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 examples/Sample/Sample/CustomDataSource.swift diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 2ef86d5..1329ffd 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 48A199CF1D8C546000C443D3 /* Images.zip in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CB1D8C546000C443D3 /* Images.zip */; }; 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CC1D8C546000C443D3 /* Stitch.jpg */; }; 48A24C331D8C59250044C697 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48A24C321D8C59250044C697 /* FileBrowser.framework */; }; + C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -45,6 +46,7 @@ 48A199CB1D8C546000C443D3 /* Images.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Images.zip; sourceTree = ""; }; 48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; 48A24C321D8C59250044C697 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDataSource.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -113,6 +115,7 @@ isa = PBXGroup; children = ( 48A199C71D8C53E200C443D3 /* MainViewController.swift */, + C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */, ); name = "View Controller"; sourceTree = ""; @@ -153,7 +156,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0810; ORGANIZATIONNAME = "Mihail Șalari"; TargetAttributes = { 48A199AC1D8C53AC00C443D3 = { @@ -206,6 +209,7 @@ files = ( 48A199C81D8C53E200C443D3 /* MainViewController.swift in Sources */, 48A199C51D8C53DB00C443D3 /* AppDelegate.swift in Sources */, + C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -249,6 +253,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -299,6 +304,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; diff --git a/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme b/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme index e8a4bce..5147bbd 100644 --- a/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme +++ b/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme @@ -1,6 +1,6 @@ - + + + + + - + @@ -19,13 +22,21 @@ + diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift new file mode 100644 index 0000000..ff3604b --- /dev/null +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -0,0 +1,80 @@ +// +// CustomDataSource.swift +// Sample +// +// Created by Carl Julius Gödecken on 28/12/2016. +// Copyright © 2016 Carl Julius Gödecken. +// + +import Foundation +import FileBrowser + +open class CustomDataSource: FileBrowserDataSource { + + public var excludesFileExtensions: [String]? = nil + public var excludesFilepaths: [URL]? = nil + public var excludesWithEmptyFilenames = false + + public var rootURL: URL { + return Directory.root.url() + } + + let fileManager = FileManager.default + + enum Directory { + case root + case imagesFolder + + func url() -> URL { + switch self { + case .root: + return URL(string: "/")! + case .imagesFolder: + return Directory.root.url().appendingPathComponent("Images", isDirectory: true) + } + } + + func contentUrls() -> [URL] { + switch self { + case .root: + return [Directory.imagesFolder.url(), + self.url().appendingPathComponent("Info.plist"), + self.url().appendingPathComponent("Images.zip")] + case .imagesFolder: + return [self.url().appendingPathComponent("Baymax.jpg"), + self.url().appendingPathComponent("BB8.jpg"), + self.url().appendingPathComponent("Stitch.jpg")] + } + } + + func contents() -> [FBFile] { + return contentUrls().map(FBFile.init) + } + } + + public func contents(ofDirectoryWithURL directoryURL: URL) throws -> [FBFile] { + + switch(directoryURL) { + case Directory.root.url(): + return Directory.root.contents() + case Directory.imagesFolder.url(): + return Directory.imagesFolder.contents() + default: + return [] + } + + } + + public func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? { + return nil + } + + + public func dataURL(forFile file: FBFile) throws -> URL { + // all the files are contained in the bundle, access them by filename + let bundleUrl = Bundle.main.resourceURL! + let filename = file.filePath.lastPathComponent + return bundleUrl.appendingPathComponent(filename) + } + +} diff --git a/examples/Sample/Sample/View Controller/MainViewController.swift b/examples/Sample/Sample/View Controller/MainViewController.swift index c5594fe..e4920e3 100644 --- a/examples/Sample/Sample/View Controller/MainViewController.swift +++ b/examples/Sample/Sample/View Controller/MainViewController.swift @@ -26,7 +26,12 @@ class MainViewController: UIViewController { @IBAction func showFileBrowser(sender: AnyObject) { let file = FileBrowser() present(file, animated: true, completion: nil) - //self.present(fileBrowser, animated: true, completion: nil) + } + + @IBAction func showCustomFileBrowser(_ sender: Any) { + let dataSource = CustomDataSource() + let browser = FileBrowser(dataSource: dataSource) + present(browser, animated: true, completion: nil) } } From 133c910f53738facfda85afa8db4eb180920e505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Wed, 28 Dec 2016 22:27:01 +0100 Subject: [PATCH 03/36] Fix tests --- FileBrowserTests/FileBrowserTests.swift | 32 +++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/FileBrowserTests/FileBrowserTests.swift b/FileBrowserTests/FileBrowserTests.swift index 286b019..705264c 100644 --- a/FileBrowserTests/FileBrowserTests.swift +++ b/FileBrowserTests/FileBrowserTests.swift @@ -46,26 +46,34 @@ class FileBrowserTests: XCTestCase { } func testDirectoryContentsParse() { - let parser = FileParser.sharedInstance + let parser = LocalFileParser() let directoryPath = Bundle(for: FileBrowserTests.self).bundleURL - let directoryContents = parser.filesForDirectory(directoryPath) - XCTAssertTrue(directoryContents.count > 0) - let stitchFile = directoryContents.filter({$0.displayName == "Stitch.jpg"}).first - XCTAssertNotNil(stitchFile) - if let stitchFile = stitchFile { - XCTAssertEqual(stitchFile.type, FBFileType.JPG) + do { + let directoryContents = try parser.contents(ofDirectoryWithURL: directoryPath) + XCTAssertTrue(directoryContents.count > 0) + let stitchFile = directoryContents.filter({$0.displayName == "Stitch.jpg"}).first + XCTAssertNotNil(stitchFile) + if let stitchFile = stitchFile { + XCTAssertEqual(stitchFile.type, FBFileType.JPG) + } + } catch let error { + XCTFail(error.localizedDescription) } } func testCaseSensitiveExclusion() { - let parser = FileParser.sharedInstance + let parser = LocalFileParser() parser.excludesFileExtensions = ["gIf"] let directoryPath = Bundle(for: FileBrowserTests.self).bundleURL - let directoryContents = parser.filesForDirectory(directoryPath) - for file in directoryContents { - if let fileExtension = file.fileExtension { - XCTAssertFalse(fileExtension == "gif") + do { + let directoryContents = try parser.contents(ofDirectoryWithURL: directoryPath) + for file in directoryContents { + if let fileExtension = file.fileExtension { + XCTAssertFalse(fileExtension == "gif") + } } + } catch let error { + XCTFail(error.localizedDescription) } } From a06cf13ac879787224d04785ca49ceaf0a292228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Wed, 28 Dec 2016 22:27:40 +0100 Subject: [PATCH 04/36] Remove development team from build settings --- examples/Sample/Sample.xcodeproj/project.pbxproj | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 1329ffd..cea18cd 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -161,7 +161,6 @@ TargetAttributes = { 48A199AC1D8C53AC00C443D3 = { CreatedOnToolsVersion = 8.0; - DevelopmentTeam = U82TG7992X; LastSwiftMigration = 0800; ProvisioningStyle = Automatic; }; @@ -335,7 +334,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = U82TG7992X; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -351,7 +350,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = U82TG7992X; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; From b4d6b0eb51864c039814e0799b7a328c282546e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Thu, 29 Dec 2016 12:56:51 +0100 Subject: [PATCH 05/36] Replace URLs with FBFiles as directory descriptors --- FileBrowser/FileBrowser.swift | 2 +- FileBrowser/FileBrowserDataSource.swift | 4 ++-- FileBrowser/FileListTableView.swift | 2 +- FileBrowser/FileListViewController.swift | 10 +++++----- FileBrowser/FileParser.swift | 9 +++++---- examples/Sample/Sample/CustomDataSource.swift | 10 ++++++---- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/FileBrowser/FileBrowser.swift b/FileBrowser/FileBrowser.swift index d1fae18..551e9c6 100644 --- a/FileBrowser/FileBrowser.swift +++ b/FileBrowser/FileBrowser.swift @@ -69,7 +69,7 @@ open class FileBrowser: UINavigationController { */ public convenience init(dataSource: FileBrowserDataSource) { - let fileListViewController = FileListViewController(dataSource: dataSource, withDirectory: dataSource.rootURL) + let fileListViewController = FileListViewController(dataSource: dataSource, withDirectory: dataSource.rootDirectory) self.init(rootViewController: fileListViewController) self.dataSource = dataSource self.view.backgroundColor = UIColor.white diff --git a/FileBrowser/FileBrowserDataSource.swift b/FileBrowser/FileBrowserDataSource.swift index 2ecf8c4..aab427f 100644 --- a/FileBrowser/FileBrowserDataSource.swift +++ b/FileBrowser/FileBrowserDataSource.swift @@ -9,8 +9,8 @@ import Foundation public protocol FileBrowserDataSource { - var rootURL: URL { get } - func contents(ofDirectoryWithURL directoryURL: URL) throws -> [FBFile] + var rootDirectory: FBFile { get } + func contents(ofDirectory directory: FBFile) throws -> [FBFile] func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? func data(forFile file: FBFile) throws -> Data func dataURL(forFile file: FBFile) throws -> URL diff --git a/FileBrowser/FileListTableView.swift b/FileBrowser/FileListTableView.swift index 2e3832a..a03d9d0 100644 --- a/FileBrowser/FileListTableView.swift +++ b/FileBrowser/FileListTableView.swift @@ -43,7 +43,7 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate { let selectedFile = fileForIndexPath(indexPath) searchController.isActive = false if selectedFile.isDirectory { - let fileListViewController = FileListViewController(dataSource: dataSource, withDirectory: selectedFile.filePath) + let fileListViewController = FileListViewController(dataSource: dataSource, withDirectory: selectedFile) fileListViewController.didSelectFile = didSelectFile self.navigationController?.pushViewController(fileListViewController, animated: true) } diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index 1a3b919..c5d5a9d 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -15,7 +15,7 @@ class FileListViewController: UIViewController { let collation = UILocalizedIndexedCollation.current() /// Data - var directoryPath: URL! + var directory: FBFile! var dataSource: FileBrowserDataSource! var didSelectFile: ((FBFile) -> ())? @@ -36,15 +36,15 @@ class FileListViewController: UIViewController { //MARK: Lifecycle - convenience init (dataSource: FileBrowserDataSource, withDirectory directoryPath: URL) { + convenience init (dataSource: FileBrowserDataSource, withDirectory directory: FBFile) { self.init(nibName: "FileBrowser", bundle: Bundle(for: FileListViewController.self)) self.edgesForExtendedLayout = UIRectEdge() // Set implicitly unwrapped optionals self.dataSource = dataSource - self.directoryPath = directoryPath + self.directory = directory - self.title = directoryPath.lastPathComponent + self.title = directory.displayName // Set search controller delegates searchController.searchResultsUpdater = self @@ -71,7 +71,7 @@ class FileListViewController: UIViewController { // Prepare data do { - files = try dataSource.contents(ofDirectoryWithURL: self.directoryPath) + files = try dataSource.contents(ofDirectory: self.directory) indexFiles() } catch let error { // TODO: error handling diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index 5fe037c..092017f 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -22,15 +22,16 @@ class LocalFileParser: FileBrowserDataSource { return fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL } - var rootURL: URL { - return customRootUrl ?? defaultRootUrl + var rootDirectory: FBFile { + let url = customRootUrl ?? defaultRootUrl + return FBFile(filePath: url) } - func contents(ofDirectoryWithURL directoryURL: URL) throws -> [FBFile] { + func contents(ofDirectory directory: FBFile) throws -> [FBFile] { // Get contents - let filePaths = try self.fileManager.contentsOfDirectory(at: directoryURL, includingPropertiesForKeys: [], options: [.skipsHiddenFiles]) + let filePaths = try self.fileManager.contentsOfDirectory(at: directory.filePath, includingPropertiesForKeys: [], options: [.skipsHiddenFiles]) // Filter var files = filePaths.map(FBFile.init) diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index ff3604b..9f3a396 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -11,12 +11,14 @@ import FileBrowser open class CustomDataSource: FileBrowserDataSource { + + public var excludesFileExtensions: [String]? = nil public var excludesFilepaths: [URL]? = nil public var excludesWithEmptyFilenames = false - public var rootURL: URL { - return Directory.root.url() + public var rootDirectory: FBFile { + return FBFile(filePath: Directory.root.url()) } let fileManager = FileManager.default @@ -52,9 +54,9 @@ open class CustomDataSource: FileBrowserDataSource { } } - public func contents(ofDirectoryWithURL directoryURL: URL) throws -> [FBFile] { + public func contents(ofDirectory directory: FBFile) throws -> [FBFile] { - switch(directoryURL) { + switch(directory.filePath) { case Directory.root.url(): return Directory.root.contents() case Directory.imagesFolder.url(): From 06679789434566c8683dc29b00691e83ae472165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Thu, 29 Dec 2016 18:44:50 +0100 Subject: [PATCH 06/36] Add AlamoFire pod --- FileBrowser.podspec | 1 + FileBrowser.xcodeproj/project.pbxproj | 121 ++++++++++++++++++ .../contents.xcworkspacedata | 6 + Podfile | 20 +++ Podfile.lock | 12 ++ examples/Sample/Podfile | 2 + examples/Sample/Podfile.lock | 19 +++ .../Sample/Sample.xcodeproj/project.pbxproj | 89 ++++++++++++- 8 files changed, 265 insertions(+), 5 deletions(-) create mode 100644 Podfile create mode 100644 Podfile.lock create mode 100644 examples/Sample/Podfile.lock diff --git a/FileBrowser.podspec b/FileBrowser.podspec index 2da9b4c..3183bf0 100644 --- a/FileBrowser.podspec +++ b/FileBrowser.podspec @@ -36,5 +36,6 @@ Pod::Spec.new do |s| # s.public_header_files = 'Pod/Classes/**/*.h' s.frameworks = 'QuickLook', 'WebKit' # s.dependency 'AFNetworking', '~> 2.3' + s.dependency 'Alamofire', '~> 4.0' end diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 9939ab4..35688cb 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -34,6 +34,8 @@ 349A12371C707E86005435C0 /* pdf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* pdf@2x.png */; }; 349A12381C707E86005435C0 /* zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* zip@2x.png */; }; C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; + EF625EC2B40CCCD7D8AE971D /* Pods_FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DF06627E7F943CB447A98B0 /* Pods_FileBrowser.framework */; }; + F3C66B149062BD5D82C379DC /* Pods_FileBrowserTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05BE57F81A542CF1F59ECC5E /* Pods_FileBrowserTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -47,6 +49,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 05BE57F81A542CF1F59ECC5E /* Pods_FileBrowserTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowserTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2CBAFA7DCC17F15DC19F29F9 /* Pods-FileBrowser.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.debug.xcconfig"; sourceTree = ""; }; + 2DF06627E7F943CB447A98B0 /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 3439AB671C6F203A0058AF04 /* FileParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileParser.swift; sourceTree = ""; }; 3439AB691C6FC6D90058AF04 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; }; @@ -76,7 +81,10 @@ 349A122F1C707E86005435C0 /* image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image@2x.png"; sourceTree = ""; }; 349A12301C707E86005435C0 /* pdf@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pdf@2x.png"; sourceTree = ""; }; 349A12311C707E86005435C0 /* zip@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zip@2x.png"; sourceTree = ""; }; + 4E57A3FC58731598296113AA /* Pods-FileBrowser.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.release.xcconfig"; sourceTree = ""; }; + 9D627F86DA38E02397C44242 /* Pods-FileBrowserTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.debug.xcconfig"; sourceTree = ""; }; C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; + E6FDD9CBB6EE93AE14F27395 /* Pods-FileBrowserTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -86,6 +94,7 @@ files = ( 343C447F1C73D06200D874FB /* WebKit.framework in Frameworks */, 3439AB6A1C6FC6D90058AF04 /* QuickLook.framework in Frameworks */, + EF625EC2B40CCCD7D8AE971D /* Pods_FileBrowser.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -94,6 +103,7 @@ buildActionMask = 2147483647; files = ( 3441695F1C67812400B93D28 /* FileBrowser.framework in Frameworks */, + F3C66B149062BD5D82C379DC /* Pods_FileBrowserTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -137,6 +147,8 @@ 344169561C67812400B93D28 /* FileBrowser */, 344169621C67812400B93D28 /* FileBrowserTests */, 344169551C67812400B93D28 /* Products */, + 452DB66C2A4A48D8CA2D5E60 /* Pods */, + 807D06ADA8076AE9110E4D9E /* Frameworks */, ); sourceTree = ""; }; @@ -200,6 +212,26 @@ path = Resources; sourceTree = ""; }; + 452DB66C2A4A48D8CA2D5E60 /* Pods */ = { + isa = PBXGroup; + children = ( + 2CBAFA7DCC17F15DC19F29F9 /* Pods-FileBrowser.debug.xcconfig */, + 4E57A3FC58731598296113AA /* Pods-FileBrowser.release.xcconfig */, + 9D627F86DA38E02397C44242 /* Pods-FileBrowserTests.debug.xcconfig */, + E6FDD9CBB6EE93AE14F27395 /* Pods-FileBrowserTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 807D06ADA8076AE9110E4D9E /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2DF06627E7F943CB447A98B0 /* Pods_FileBrowser.framework */, + 05BE57F81A542CF1F59ECC5E /* Pods_FileBrowserTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -218,10 +250,12 @@ isa = PBXNativeTarget; buildConfigurationList = 344169681C67812400B93D28 /* Build configuration list for PBXNativeTarget "FileBrowser" */; buildPhases = ( + 97F2276185606A530E48022A /* [CP] Check Pods Manifest.lock */, 3441694F1C67812400B93D28 /* Sources */, 344169501C67812400B93D28 /* Frameworks */, 344169511C67812400B93D28 /* Headers */, 344169521C67812400B93D28 /* Resources */, + 32CABE09ABE7D7FC20459F67 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -236,9 +270,12 @@ isa = PBXNativeTarget; buildConfigurationList = 3441696B1C67812400B93D28 /* Build configuration list for PBXNativeTarget "FileBrowserTests" */; buildPhases = ( + 7DD199DB9CF8B53ECE58398F /* [CP] Check Pods Manifest.lock */, 3441695A1C67812400B93D28 /* Sources */, 3441695B1C67812400B93D28 /* Frameworks */, 3441695C1C67812400B93D28 /* Resources */, + 2A9CF224D87561AA2418C6A3 /* [CP] Embed Pods Frameworks */, + 10725DD9F99E84C93C02370B /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -317,6 +354,84 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 10725DD9F99E84C93C02370B /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 2A9CF224D87561AA2418C6A3 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 32CABE09ABE7D7FC20459F67 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 7DD199DB9CF8B53ECE58398F /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 97F2276185606A530E48022A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 3441694F1C67812400B93D28 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -453,12 +568,14 @@ }; 344169691C67812400B93D28 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 2CBAFA7DCC17F15DC19F29F9 /* Pods-FileBrowser.debug.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 6; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_BITCODE = NO; INFOPLIST_FILE = FileBrowser/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -473,12 +590,14 @@ }; 3441696A1C67812400B93D28 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 4E57A3FC58731598296113AA /* Pods-FileBrowser.release.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 6; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_BITCODE = NO; INFOPLIST_FILE = FileBrowser/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -492,6 +611,7 @@ }; 3441696C1C67812400B93D28 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 9D627F86DA38E02397C44242 /* Pods-FileBrowserTests.debug.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FileBrowserTests/Info.plist; @@ -504,6 +624,7 @@ }; 3441696D1C67812400B93D28 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = E6FDD9CBB6EE93AE14F27395 /* Pods-FileBrowserTests.release.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FileBrowserTests/Info.plist; diff --git a/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata b/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata index 877319b..8d9274f 100644 --- a/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata +++ b/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata @@ -7,4 +7,10 @@ + + + + diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..034c48c --- /dev/null +++ b/Podfile @@ -0,0 +1,20 @@ +# Uncomment the next line to define a global platform for your project +# platform :ios, '9.0' + +project 'FileBrowser' +workspace 'FileBrowserWorkspace' + +#link_with 'FileBrowser' +target 'FileBrowser' do + # Comment the next line if you're not using Swift and don't want to use dynamic frameworks + use_frameworks! + + # Pods for FileBrowser + pod 'Alamofire', '~> 4.0' + + target 'FileBrowserTests' do + inherit! :search_paths + # Pods for testing + end + +end diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..952ff8f --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,12 @@ +PODS: + - Alamofire (4.2.0) + +DEPENDENCIES: + - Alamofire (~> 4.0) + +SPEC CHECKSUMS: + Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe + +PODFILE CHECKSUM: 79a6ed7d2e5f0fd6c5680daf3c5eb5fa3e540292 + +COCOAPODS: 1.1.1 diff --git a/examples/Sample/Podfile b/examples/Sample/Podfile index c42d04e..948d4fd 100644 --- a/examples/Sample/Podfile +++ b/examples/Sample/Podfile @@ -2,6 +2,8 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, "8.0" use_frameworks! +workspace 'FileBrowser' #'../../FileBrowserWorkspace' + target 'Sample' do pod 'FileBrowser', :path => '../..' end diff --git a/examples/Sample/Podfile.lock b/examples/Sample/Podfile.lock new file mode 100644 index 0000000..841fccd --- /dev/null +++ b/examples/Sample/Podfile.lock @@ -0,0 +1,19 @@ +PODS: + - Alamofire (4.2.0) + - FileBrowser (0.2.0): + - Alamofire (~> 4.0) + +DEPENDENCIES: + - FileBrowser (from `../..`) + +EXTERNAL SOURCES: + FileBrowser: + :path: "../.." + +SPEC CHECKSUMS: + Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe + FileBrowser: f4e75766110f2cce2f68de8fcd4a3bc821748c80 + +PODFILE CHECKSUM: 57f48c9221084d5581049b0789375ff710d2d560 + +COCOAPODS: 1.1.1 diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index cea18cd..4b6ba98 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -18,6 +18,8 @@ 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CC1D8C546000C443D3 /* Stitch.jpg */; }; 48A24C331D8C59250044C697 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48A24C321D8C59250044C697 /* FileBrowser.framework */; }; C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */; }; + C3BF0E061E1563F10009D12C /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E051E1563F10009D12C /* Podfile */; }; + CA1A267CE65797AC47128D97 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4492ECEB106C60695FBD72D5 /* Pods_Sample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -34,6 +36,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 10BC242BACC546476B0DAD18 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; + 4492ECEB106C60695FBD72D5 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 48A199AD1D8C53AC00C443D3 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48A199B51D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48A199B71D8C53AC00C443D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -47,6 +51,12 @@ 48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; 48A24C321D8C59250044C697 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDataSource.swift; sourceTree = ""; }; + C3BF0E051E1563F10009D12C /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; }; + C3BF0E071E156BE60009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + C3BF0E091E156C0A0009D12C /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_FileBrowser.framework; path = "/Users/carl/Developer/FileBrowser/Pods/../build/Debug-iphoneos/Pods_FileBrowser.framework"; sourceTree = ""; }; + C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + C3BF0E0D1E1572530009D12C /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_FileBrowser.framework; path = "/Users/carl/Developer/FileBrowser/Pods/../build/Debug-iphoneos/Pods_FileBrowser.framework"; sourceTree = ""; }; + E0892FCFB758A36A235DCF55 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,19 +64,31 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 48A24C331D8C59250044C697 /* FileBrowser.framework in Frameworks */, + C3BF0E0C1E15723A0009D12C /* FileBrowser.framework in Frameworks */, + CA1A267CE65797AC47128D97 /* Pods_Sample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 222063E52114BD683D3CB257 /* Pods */ = { + isa = PBXGroup; + children = ( + C3BF0E051E1563F10009D12C /* Podfile */, + E0892FCFB758A36A235DCF55 /* Pods-Sample.debug.xcconfig */, + 10BC242BACC546476B0DAD18 /* Pods-Sample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; 48A199A41D8C53AC00C443D3 = { isa = PBXGroup; children = ( 48A199AF1D8C53AC00C443D3 /* Sample */, 48A199AE1D8C53AC00C443D3 /* Products */, 48A24C2F1D8C57390044C697 /* Frameworks */, + 222063E52114BD683D3CB257 /* Pods */, ); sourceTree = ""; }; @@ -123,7 +145,12 @@ 48A24C2F1D8C57390044C697 /* Frameworks */ = { isa = PBXGroup; children = ( + C3BF0E0D1E1572530009D12C /* Pods_FileBrowser.framework */, + C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */, + C3BF0E091E156C0A0009D12C /* Pods_FileBrowser.framework */, + C3BF0E071E156BE60009D12C /* FileBrowser.framework */, 48A24C321D8C59250044C697 /* FileBrowser.framework */, + 4492ECEB106C60695FBD72D5 /* Pods_Sample.framework */, ); name = Frameworks; sourceTree = ""; @@ -135,10 +162,13 @@ isa = PBXNativeTarget; buildConfigurationList = 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( + 2C1B40A688D6C00931B72750 /* [CP] Check Pods Manifest.lock */, 48A199A91D8C53AC00C443D3 /* Sources */, 48A199AA1D8C53AC00C443D3 /* Frameworks */, 48A199AB1D8C53AC00C443D3 /* Resources */, 48A199DD1D8C564100C443D3 /* Embed Frameworks */, + 8D2CAA50D1ABB5C35AAE68CA /* [CP] Embed Pods Frameworks */, + 0077E0574CB309911BBE72D7 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -191,6 +221,7 @@ files = ( 48A199BB1D8C53AC00C443D3 /* LaunchScreen.storyboard in Resources */, 48A199CF1D8C546000C443D3 /* Images.zip in Resources */, + C3BF0E061E1563F10009D12C /* Podfile in Resources */, 48A199B81D8C53AC00C443D3 /* Assets.xcassets in Resources */, 48A199B61D8C53AC00C443D3 /* Main.storyboard in Resources */, 48A199CD1D8C546000C443D3 /* Baymax.jpg in Resources */, @@ -201,6 +232,54 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 0077E0574CB309911BBE72D7 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 2C1B40A688D6C00931B72750 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 8D2CAA50D1ABB5C35AAE68CA /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 48A199A91D8C53AC00C443D3 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -256,7 +335,6 @@ CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -307,7 +385,6 @@ CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; @@ -331,11 +408,12 @@ }; 48A199C01D8C53AC00C443D3 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = E0892FCFB758A36A235DCF55 /* Pods-Sample.debug.xcconfig */; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; DEVELOPMENT_TEAM = ""; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mihailsalari.Sample; @@ -347,11 +425,12 @@ }; 48A199C11D8C53AC00C443D3 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 10BC242BACC546476B0DAD18 /* Pods-Sample.release.xcconfig */; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; DEVELOPMENT_TEAM = ""; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mihailsalari.Sample; From 7c45c121129d1336572846c761ccff2668b8c663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Thu, 29 Dec 2016 23:56:24 +0100 Subject: [PATCH 07/36] Update .gitignore to exclude pods --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5e5d5ce..90a386a 100644 --- a/.gitignore +++ b/.gitignore @@ -43,7 +43,7 @@ playground.xcworkspace # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # -# Pods/ + **/Pods/ # Carthage # From 6added554334bf67d2a857543af70949f76d7406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 00:05:38 +0100 Subject: [PATCH 08/36] Add and integrate LoadingViewController, numerous other changes Change FBFile to use separate properties for file tree and data URLs --- FileBrowser.xcodeproj/project.pbxproj | 8 ++ FileBrowser/FBFile.swift | 33 +++++--- FileBrowser/FileListPreview.swift | 2 +- FileBrowser/FileListTableView.swift | 2 +- FileBrowser/FileParser.swift | 8 +- FileBrowser/LoadingViewController.swift | 82 +++++++++++++++++++ FileBrowser/PreviewManager.swift | 37 +++++++-- .../Resources/LoadingViewController.xib | 48 +++++++++++ FileBrowser/WebviewPreviewViewContoller.swift | 32 ++++++-- 9 files changed, 222 insertions(+), 30 deletions(-) create mode 100644 FileBrowser/LoadingViewController.swift create mode 100644 FileBrowser/Resources/LoadingViewController.xib diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 35688cb..e6006a3 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -34,6 +34,8 @@ 349A12371C707E86005435C0 /* pdf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* pdf@2x.png */; }; 349A12381C707E86005435C0 /* zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* zip@2x.png */; }; C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; + C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; + C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; }; EF625EC2B40CCCD7D8AE971D /* Pods_FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DF06627E7F943CB447A98B0 /* Pods_FileBrowser.framework */; }; F3C66B149062BD5D82C379DC /* Pods_FileBrowserTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05BE57F81A542CF1F59ECC5E /* Pods_FileBrowserTests.framework */; }; /* End PBXBuildFile section */ @@ -84,6 +86,8 @@ 4E57A3FC58731598296113AA /* Pods-FileBrowser.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.release.xcconfig"; sourceTree = ""; }; 9D627F86DA38E02397C44242 /* Pods-FileBrowserTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.debug.xcconfig"; sourceTree = ""; }; C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; + C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = ""; }; + C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; E6FDD9CBB6EE93AE14F27395 /* Pods-FileBrowserTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -134,6 +138,7 @@ 343C44601C73CC3C00D874FB /* Preview */ = { isa = PBXGroup; children = ( + C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */, 343C44611C73CC8100D874FB /* PreviewTransitionViewController.swift */, 343C44651C73CD3200D874FB /* PreviewManager.swift */, 343C44781C73CFC400D874FB /* WebviewPreviewViewContoller.swift */, @@ -202,6 +207,7 @@ 349A122B1C707E86005435C0 /* documents@2x.png */, 349A122C1C707E86005435C0 /* file@2x.png */, 349A122D1C707E86005435C0 /* FileBrowser.xib */, + C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */, 349A122E1C707E86005435C0 /* folder@2x.png */, 349A122F1C707E86005435C0 /* image@2x.png */, 349A12301C707E86005435C0 /* pdf@2x.png */, @@ -334,6 +340,7 @@ 343C44681C73CD8700D874FB /* PreviewTransitionViewController.xib in Resources */, 349A12331C707E86005435C0 /* file@2x.png in Resources */, 349A12341C707E86005435C0 /* FileBrowser.xib in Resources */, + C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */, 343C447D1C73CFD900D874FB /* WebviewPreviewViewContoller.xib in Resources */, 349A12361C707E86005435C0 /* image@2x.png in Resources */, 349A12371C707E86005435C0 /* pdf@2x.png in Resources */, @@ -448,6 +455,7 @@ 3437405B1C6E7DA50090FD6A /* FileListViewController.swift in Sources */, 349A12241C70725D005435C0 /* FileListSearch.swift in Sources */, 3439AB6C1C6FD6650058AF04 /* FileListPreview.swift in Sources */, + C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/FileBrowser/FBFile.swift b/FileBrowser/FBFile.swift index fb460c0..86136e3 100644 --- a/FileBrowser/FBFile.swift +++ b/FileBrowser/FBFile.swift @@ -11,17 +11,20 @@ import Foundation /// FBFile is a class representing a file in FileBrowser open class FBFile: NSObject { /// Display name. String. - open let displayName: String + open var displayName: String // is Directory. Bool. open let isDirectory: Bool /// File extension. open let fileExtension: String? /// File attributes (including size, creation date etc). //open let fileAttributes: NSDictionary? = nil - /// NSURL file path. - open let filePath: URL + + /// Describes where the resource can be found. May be a file:// or http[s]:// URL + open var fileLocation: URL? // FBFileType - open let type: FBFileType + open var type: FBFileType + + open let path: URL /** Initialize an FBFile object with a filePath @@ -30,24 +33,28 @@ open class FBFile: NSObject { - returns: FBFile object. */ - public init(filePath: URL) { - self.filePath = filePath - self.isDirectory = checkDirectory(filePath) + public init(path: URL) { + self.path = path + self.isDirectory = checkDirectory(path) if self.isDirectory { self.fileExtension = nil self.type = .Directory } else { - self.fileExtension = filePath.pathExtension - if let fileExtension = fileExtension { - self.type = FBFileType(rawValue: fileExtension) ?? .Default - } - else { + if path.pathExtension != "" { + self.fileExtension = path.pathExtension + self.type = FBFileType(rawValue: fileExtension!) ?? .Default + } else { + self.fileExtension = nil self.type = .Default } } - self.displayName = filePath.lastPathComponent + self.displayName = path.lastPathComponent + } + + public var isRemoteFile: Bool { + return fileLocation?.scheme == "http" || fileLocation?.scheme == "https" } } diff --git a/FileBrowser/FileListPreview.swift b/FileBrowser/FileListPreview.swift index d2bc8e9..6d32b1b 100644 --- a/FileBrowser/FileListPreview.swift +++ b/FileBrowser/FileListPreview.swift @@ -27,7 +27,7 @@ extension FileListViewController: UIViewControllerPreviewingDelegate { let selectedFile = fileForIndexPath(indexPath) previewingContext.sourceRect = tableView.rectForRow(at: indexPath) if selectedFile.isDirectory == false { - return previewManager.previewViewControllerForFile(selectedFile, dataSource: dataSource, fromNavigation: false) + return previewManager.previewViewControllerForFile(selectedFile, data: nil, fromNavigation: false) } } } diff --git a/FileBrowser/FileListTableView.swift b/FileBrowser/FileListTableView.swift index a03d9d0..e336f65 100644 --- a/FileBrowser/FileListTableView.swift +++ b/FileBrowser/FileListTableView.swift @@ -53,7 +53,7 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate { didSelectFile(selectedFile) } else { - let filePreview = previewManager.previewViewControllerForFile(selectedFile, dataSource: dataSource, fromNavigation: true) + let filePreview = previewManager.previewViewControllerForFile(selectedFile, data: nil, fromNavigation: true) self.navigationController?.pushViewController(filePreview, animated: true) } } diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index 092017f..b74989a 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -24,14 +24,14 @@ class LocalFileParser: FileBrowserDataSource { var rootDirectory: FBFile { let url = customRootUrl ?? defaultRootUrl - return FBFile(filePath: url) + return FBFile(path: url) } func contents(ofDirectory directory: FBFile) throws -> [FBFile] { // Get contents - let filePaths = try self.fileManager.contentsOfDirectory(at: directory.filePath, includingPropertiesForKeys: [], options: [.skipsHiddenFiles]) + let filePaths = try self.fileManager.contentsOfDirectory(at: directory.path, includingPropertiesForKeys: [], options: [.skipsHiddenFiles]) // Filter var files = filePaths.map(FBFile.init) @@ -40,7 +40,7 @@ class LocalFileParser: FileBrowserDataSource { files = files.filter { !lowercased.contains($0.fileExtension?.lowercased() ?? "") } } if let excludesFilepaths = excludesFilepaths { - files = files.filter { !excludesFilepaths.contains($0.filePath) } + files = files.filter { !excludesFilepaths.contains($0.path) } } if excludesWithEmptyFilenames { files = files.filter { !$0.displayName.isEmpty } @@ -62,7 +62,7 @@ class LocalFileParser: FileBrowserDataSource { } func dataURL(forFile file: FBFile) throws -> URL { - return file.filePath + return file.path } diff --git a/FileBrowser/LoadingViewController.swift b/FileBrowser/LoadingViewController.swift new file mode 100644 index 0000000..cc0a8f2 --- /dev/null +++ b/FileBrowser/LoadingViewController.swift @@ -0,0 +1,82 @@ +// +// LoadingViewController.swift +// FileBrowser +// +// Created by Carl Julius Gödecken on 29/12/2016. +// Copyright © 2016 Carl Julius Gödecken. +// + +import Foundation +import Alamofire +import QuickLook + + +class LoadingViewController: UIViewController { + //MARK: Lifecycle + + @IBOutlet var progressView: UIProgressView! + + + var file: FBFile! + convenience init (file: FBFile) { + self.init(nibName: "LoadingViewController", bundle: Bundle(for: LoadingViewController.self)) + self.file = file + self.title = file.displayName + } + + var request: DataRequest? + + override func viewDidLoad() { + super.viewDidLoad() + progressView.setProgress(0, animated: false) + guard let fileLocation = file.fileLocation else { + print("Error: File has no fileLocation set") + return + } + + Alamofire + .request(fileLocation) + .validate() + .downloadProgress { progress in + self.progressView.setProgress(Float(progress.fractionCompleted), animated: true) + } + .responseData { response in + switch response.result { + case .success: + let data = response.data + self.showFile(data: data) + case .failure(let error): + print(error) // TODO: display the error + } + } + } + + + @IBAction func cancelButtonTapped(_ sender: Any) { + request?.cancel() + } + + func showFile(data: Data?) { + let previewManager = PreviewManager() + let controller = previewManager.previewViewControllerForFile(self.file, data: data, fromNavigation: true) + DispatchQueue.main.async { + if let nav = self.navigationController { + //nav.pushViewController(controller, animated: true) + + var viewControllers = nav.viewControllers + viewControllers.removeLast(1) + viewControllers.append(controller) + nav.setViewControllers(viewControllers, animated: true) + + } else { + self.present(controller, animated: true, completion: nil) + } + if let ql = (controller as? QLPreviewController) ?? (controller as? PreviewTransitionViewController)?.quickLookPreviewController { + // fix for dataSource magically disappearing because hey let's store it in a weak variable in QLPreviewController + ql.dataSource = previewManager + ql.reloadData() + } + } + } +} + diff --git a/FileBrowser/PreviewManager.swift b/FileBrowser/PreviewManager.swift index a340a58..0a0696e 100644 --- a/FileBrowser/PreviewManager.swift +++ b/FileBrowser/PreviewManager.swift @@ -12,20 +12,23 @@ import QuickLook class PreviewManager: NSObject, QLPreviewControllerDataSource { var file: FBFile? - var dataSource: FileBrowserDataSource? + var fileData: Data? - func previewViewControllerForFile(_ file: FBFile, dataSource: FileBrowserDataSource, fromNavigation: Bool) -> UIViewController { + func previewViewControllerForFile(_ file: FBFile, data: Data?, fromNavigation: Bool) -> UIViewController { + if data == nil && file.isRemoteFile { + return LoadingViewController(file: file) + } if file.type == .PLIST || file.type == .JSON { let webviewPreviewViewContoller = WebviewPreviewViewContoller(nibName: "WebviewPreviewViewContoller", bundle: Bundle(for: WebviewPreviewViewContoller.self)) - webviewPreviewViewContoller.dataSource = dataSource + webviewPreviewViewContoller.fileData = data webviewPreviewViewContoller.file = file return webviewPreviewViewContoller } else { let previewTransitionViewController = PreviewTransitionViewController(nibName: "PreviewTransitionViewController", bundle: Bundle(for: PreviewTransitionViewController.self)) self.file = file - self.dataSource = dataSource + self.fileData = data previewTransitionViewController.quickLookPreviewController.dataSource = self @@ -43,11 +46,33 @@ class PreviewManager: NSObject, QLPreviewControllerDataSource { func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { let item = PreviewItem() - if let file = file, let filePath = try? dataSource?.dataURL(forFile: file) { - item.filePath = filePath + + if let file = file, + let fileData = fileData, + let url = copyDataToTemporaryDirectory(fileData, file: file) { + item.filePath = url + } else if let file = file, let url = file.fileLocation, url.scheme == "file" { + item.filePath = url } + return item } + + func copyDataToTemporaryDirectory(_ data: Data, file: FBFile) -> URL? + { + let tempDirectoryURL = NSURL.fileURL(withPath: NSTemporaryDirectory(), isDirectory: true) + let fileExtension = file.fileExtension ?? file.type.rawValue + let targetURL = tempDirectoryURL.appendingPathComponent("\(file.displayName).\(fileExtension)") // TODO: better file extensions + + // Copy the file. + do { + try data.write(to: targetURL) + return targetURL + } catch let error { + print("Unable to copy file: \(error)") + return nil + } + } } class PreviewItem: NSObject, QLPreviewItem { diff --git a/FileBrowser/Resources/LoadingViewController.xib b/FileBrowser/Resources/LoadingViewController.xib new file mode 100644 index 0000000..799d8f7 --- /dev/null +++ b/FileBrowser/Resources/LoadingViewController.xib @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FileBrowser/WebviewPreviewViewContoller.swift b/FileBrowser/WebviewPreviewViewContoller.swift index a91e506..0fdd55d 100644 --- a/FileBrowser/WebviewPreviewViewContoller.swift +++ b/FileBrowser/WebviewPreviewViewContoller.swift @@ -14,13 +14,14 @@ class WebviewPreviewViewContoller: UIViewController { var webView = WKWebView() - var dataSource: FileBrowserDataSource! var file: FBFile? { didSet { self.title = file?.displayName self.processForDisplay() } } + + var fileData: Data? //MARK: Lifecycle @@ -41,11 +42,20 @@ class WebviewPreviewViewContoller: UIViewController { //MARK: Share func shareFile() { - guard let file = file, - let url = try? dataSource.dataURL(forFile: file) else { + guard let file = file else { return } - let activityViewController = UIActivityViewController(activityItems: [file.filePath], applicationActivities: nil) + + let activityItems: [Any] + if let data = fileData { + activityItems = [data] + } else if let url = file.fileLocation { + activityItems = [url] + } else { + return + } + + let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil) self.present(activityViewController, animated: true, completion: nil) } @@ -53,9 +63,21 @@ class WebviewPreviewViewContoller: UIViewController { //MARK: Processing func processForDisplay() { - guard let file = file, let data = try? dataSource.data(forFile: file) else { + guard let file = file else { return } + + let data: Data + if let fileData = fileData { + data = fileData + } else if let localFileUrl = file.fileLocation, + localFileUrl.scheme == "file", + let fileData = try? Data(contentsOf: localFileUrl) { + data = fileData + } else { + return + } + var rawString: String? // Prepare plist for display From 0124669ce68090cc3662b59c3ee05d81c77b9fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 00:13:25 +0100 Subject: [PATCH 09/36] Change Sample CustomDataSource to use JSON file, adapt to changes --- .../Sample/Sample.xcodeproj/project.pbxproj | 6 +- examples/Sample/Sample/CustomDataSource.swift | 83 +++++++++---------- examples/Sample/Sample/folderContent.json | 39 +++++++++ 3 files changed, 84 insertions(+), 44 deletions(-) create mode 100644 examples/Sample/Sample/folderContent.json diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 4b6ba98..ecfa959 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -16,9 +16,10 @@ 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CA1D8C546000C443D3 /* BB8.jpg */; }; 48A199CF1D8C546000C443D3 /* Images.zip in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CB1D8C546000C443D3 /* Images.zip */; }; 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CC1D8C546000C443D3 /* Stitch.jpg */; }; - 48A24C331D8C59250044C697 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48A24C321D8C59250044C697 /* FileBrowser.framework */; }; C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */; }; C3BF0E061E1563F10009D12C /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E051E1563F10009D12C /* Podfile */; }; + C3BF0E0C1E15723A0009D12C /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */; }; + C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E0F1E1591DC0009D12C /* folderContent.json */; }; CA1A267CE65797AC47128D97 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4492ECEB106C60695FBD72D5 /* Pods_Sample.framework */; }; /* End PBXBuildFile section */ @@ -56,6 +57,7 @@ C3BF0E091E156C0A0009D12C /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_FileBrowser.framework; path = "/Users/carl/Developer/FileBrowser/Pods/../build/Debug-iphoneos/Pods_FileBrowser.framework"; sourceTree = ""; }; C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0E0D1E1572530009D12C /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_FileBrowser.framework; path = "/Users/carl/Developer/FileBrowser/Pods/../build/Debug-iphoneos/Pods_FileBrowser.framework"; sourceTree = ""; }; + C3BF0E0F1E1591DC0009D12C /* folderContent.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = folderContent.json; sourceTree = ""; }; E0892FCFB758A36A235DCF55 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -129,6 +131,7 @@ 48A199CA1D8C546000C443D3 /* BB8.jpg */, 48A199CB1D8C546000C443D3 /* Images.zip */, 48A199CC1D8C546000C443D3 /* Stitch.jpg */, + C3BF0E0F1E1591DC0009D12C /* folderContent.json */, ); name = Resources; sourceTree = ""; @@ -227,6 +230,7 @@ 48A199CD1D8C546000C443D3 /* Baymax.jpg in Resources */, 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */, 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */, + C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index 9f3a396..83db3d7 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -11,60 +11,52 @@ import FileBrowser open class CustomDataSource: FileBrowserDataSource { - + typealias KeyValue = [String: Any] + let json: KeyValue + + init() { + let jsonPath = Bundle.main.path(forResource: "folderContent", ofType: "json")! + let data = try! NSData(contentsOfFile: jsonPath, options: []) as Data + json = try! JSONSerialization.jsonObject(with: data, options: []) as! KeyValue + } public var excludesFileExtensions: [String]? = nil public var excludesFilepaths: [URL]? = nil public var excludesWithEmptyFilenames = false + let rootUrl = URL(string: "/")! public var rootDirectory: FBFile { - return FBFile(filePath: Directory.root.url()) + let file = FBFile(path: rootUrl) + file.displayName = "Home" + return file } let fileManager = FileManager.default - enum Directory { - case root - case imagesFolder - - func url() -> URL { - switch self { - case .root: - return URL(string: "/")! - case .imagesFolder: - return Directory.root.url().appendingPathComponent("Images", isDirectory: true) - } + + public func contents(ofDirectory directory: FBFile) throws -> [FBFile] { + // traverse the file tree outlined in the JSON file to find the directory + let pathComponents = Array(directory.path.pathComponents.dropFirst()) + let directoryDescription = pathComponents.reduce(json) { currentFolder, subfolderName -> KeyValue in + let content = currentFolder["content"]! as! KeyValue + return content[subfolderName] as! KeyValue } - func contentUrls() -> [URL] { - switch self { - case .root: - return [Directory.imagesFolder.url(), - self.url().appendingPathComponent("Info.plist"), - self.url().appendingPathComponent("Images.zip")] - case .imagesFolder: - return [self.url().appendingPathComponent("Baymax.jpg"), - self.url().appendingPathComponent("BB8.jpg"), - self.url().appendingPathComponent("Stitch.jpg")] + let files = (directoryDescription["content"] as! KeyValue).map {name, properties -> FBFile in + let properties = properties as! KeyValue + let isDirectory = (properties["type"] as? String) == "directory" + let path = directory.path.appendingPathComponent(name, isDirectory: isDirectory) + let file = FBFile(path: path) + if let resourceURLString = properties["location"] as? String, let resourceURL = URL(string: resourceURLString) { + file.fileLocation = resourceURL } + if let typeName = properties["type"] as? String, let type = FBFileType(rawValue: typeName) { + file.type = type + } + return file } - func contents() -> [FBFile] { - return contentUrls().map(FBFile.init) - } - } - - public func contents(ofDirectory directory: FBFile) throws -> [FBFile] { - - switch(directory.filePath) { - case Directory.root.url(): - return Directory.root.contents() - case Directory.imagesFolder.url(): - return Directory.imagesFolder.contents() - default: - return [] - } - + return files } public func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? { @@ -73,10 +65,15 @@ open class CustomDataSource: FileBrowserDataSource { public func dataURL(forFile file: FBFile) throws -> URL { - // all the files are contained in the bundle, access them by filename - let bundleUrl = Bundle.main.resourceURL! - let filename = file.filePath.lastPathComponent - return bundleUrl.appendingPathComponent(filename) + return file.fileLocation! } } + +//extension URL { +// func relativeTo(baseUrl: URL) -> URL { +// +// let keep = self.pathComponents.dropFirst(baseUrl.pathComponents.count) +// return keep.fir +// } +//} diff --git a/examples/Sample/Sample/folderContent.json b/examples/Sample/Sample/folderContent.json new file mode 100644 index 0000000..4d1c45c --- /dev/null +++ b/examples/Sample/Sample/folderContent.json @@ -0,0 +1,39 @@ +{ + "type": "directory", + "content": { + "Random image": { + "type": "jpg", + "location": "https://unsplash.it/200/300/?random" + }, + "Larger random image": { + "type": "jpg", + "location": "https://unsplash.it/1200/1800/?random" + }, + "More images": { + "type": "directory", + "content": { + "Random square image": { + "type": "jpg", + "location": "https://unsplash.it/200/?random" + }, + "Yet another random image": { + "type": "jpg", + "location": "https://unsplash.it/200/300/?random" + }, + "Very small and blurry image": { + "type": "jpg", + "location": "https://unsplash.it/16/16/?random" + } + } + }, + "Documents": { + "type": "directory", + "content": { + "users.json": { + "location": "https://jsonplaceholder.typicode.com/users" + } + } + } + } +} + From af93f76a36f4ef2119d461141021f8d95e97547b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 00:38:05 +0100 Subject: [PATCH 10/36] Fix tests --- FileBrowserTests/FileBrowserTests.swift | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/FileBrowserTests/FileBrowserTests.swift b/FileBrowserTests/FileBrowserTests.swift index 705264c..57d1fe6 100644 --- a/FileBrowserTests/FileBrowserTests.swift +++ b/FileBrowserTests/FileBrowserTests.swift @@ -23,8 +23,8 @@ class FileBrowserTests: XCTestCase { func testGifFBFileParse() { let filePath = Bundle(for: FileBrowserTests.self).url(forResource: "3crBXeO", withExtension: "gif")! - let file = FBFile(filePath: filePath) - XCTAssertEqual(file.filePath, filePath) + let file = FBFile(path: filePath) + XCTAssertEqual(file.path, filePath) XCTAssertEqual(file.isDirectory, false) XCTAssertEqual(file.type, FBFileType.GIF) XCTAssertEqual(file.fileExtension, "gif") @@ -32,8 +32,8 @@ class FileBrowserTests: XCTestCase { func testJpgFBFileParse() { let filePath = Bundle(for: FileBrowserTests.self).url(forResource: "Stitch", withExtension: "jpg")! - let file = FBFile(filePath: filePath) - XCTAssertEqual(file.filePath, filePath) + let file = FBFile(path: filePath) + XCTAssertEqual(file.path, filePath) XCTAssertEqual(file.isDirectory, false) XCTAssertEqual(file.type, FBFileType.JPG) XCTAssertEqual(file.fileExtension, "jpg") @@ -41,15 +41,16 @@ class FileBrowserTests: XCTestCase { func testDirectoryFBFileParse() { let filePath = Bundle(for: FileBrowserTests.self).bundleURL - let file = FBFile(filePath: filePath) + let file = FBFile(path: filePath) XCTAssertEqual(file.type, FBFileType.Directory) } func testDirectoryContentsParse() { let parser = LocalFileParser() let directoryPath = Bundle(for: FileBrowserTests.self).bundleURL + let directory = FBFile(path: directoryPath) do { - let directoryContents = try parser.contents(ofDirectoryWithURL: directoryPath) + let directoryContents = try parser.contents(ofDirectory: directory) XCTAssertTrue(directoryContents.count > 0) let stitchFile = directoryContents.filter({$0.displayName == "Stitch.jpg"}).first XCTAssertNotNil(stitchFile) @@ -65,8 +66,9 @@ class FileBrowserTests: XCTestCase { let parser = LocalFileParser() parser.excludesFileExtensions = ["gIf"] let directoryPath = Bundle(for: FileBrowserTests.self).bundleURL + let directory = FBFile(path: directoryPath) do { - let directoryContents = try parser.contents(ofDirectoryWithURL: directoryPath) + let directoryContents = try parser.contents(ofDirectory: directory) for file in directoryContents { if let fileExtension = file.fileExtension { XCTAssertFalse(fileExtension == "gif") From 2d25a80611617c061562db36aff131fc5b5ab9c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 12:52:00 +0100 Subject: [PATCH 11/36] Fix pods issues --- FileBrowser.xcodeproj/project.pbxproj | 88 +++++++++---------- .../contents.xcworkspacedata | 4 +- Podfile | 10 +++ Podfile.lock | 2 +- examples/Sample/Podfile | 5 +- examples/Sample/Podfile.lock | 6 +- .../Sample/Sample.xcodeproj/project.pbxproj | 70 +++++++-------- 7 files changed, 96 insertions(+), 89 deletions(-) diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index e6006a3..738b280 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0E0A64E33C26BE2270A6BB6C /* Pods_FileBrowserTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 290072F7AB49D8F2507666FE /* Pods_FileBrowserTests.framework */; }; 3437405B1C6E7DA50090FD6A /* FileListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */; }; 3439AB681C6F203A0058AF04 /* FileParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3439AB671C6F203A0058AF04 /* FileParser.swift */; }; 3439AB6A1C6FC6D90058AF04 /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3439AB691C6FC6D90058AF04 /* QuickLook.framework */; settings = {ATTRIBUTES = (Required, ); }; }; @@ -33,11 +34,10 @@ 349A12361C707E86005435C0 /* image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A122F1C707E86005435C0 /* image@2x.png */; }; 349A12371C707E86005435C0 /* pdf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* pdf@2x.png */; }; 349A12381C707E86005435C0 /* zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* zip@2x.png */; }; + 3E12044451B65836D3C0CF56 /* Pods_FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3C408ADAB2383F0BA0267CB /* Pods_FileBrowser.framework */; }; C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; }; - EF625EC2B40CCCD7D8AE971D /* Pods_FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DF06627E7F943CB447A98B0 /* Pods_FileBrowser.framework */; }; - F3C66B149062BD5D82C379DC /* Pods_FileBrowserTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05BE57F81A542CF1F59ECC5E /* Pods_FileBrowserTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -51,9 +51,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 05BE57F81A542CF1F59ECC5E /* Pods_FileBrowserTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowserTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2CBAFA7DCC17F15DC19F29F9 /* Pods-FileBrowser.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.debug.xcconfig"; sourceTree = ""; }; - 2DF06627E7F943CB447A98B0 /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1941D49CA1D047E57A6ADA64 /* Pods-FileBrowser.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.debug.xcconfig"; sourceTree = ""; }; + 290072F7AB49D8F2507666FE /* Pods_FileBrowserTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowserTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2C1FFB480907B56FC27CAFBC /* Pods-FileBrowserTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.release.xcconfig"; sourceTree = ""; }; 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 3439AB671C6F203A0058AF04 /* FileParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileParser.swift; sourceTree = ""; }; 3439AB691C6FC6D90058AF04 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; }; @@ -83,12 +83,13 @@ 349A122F1C707E86005435C0 /* image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image@2x.png"; sourceTree = ""; }; 349A12301C707E86005435C0 /* pdf@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pdf@2x.png"; sourceTree = ""; }; 349A12311C707E86005435C0 /* zip@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zip@2x.png"; sourceTree = ""; }; - 4E57A3FC58731598296113AA /* Pods-FileBrowser.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.release.xcconfig"; sourceTree = ""; }; - 9D627F86DA38E02397C44242 /* Pods-FileBrowserTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.debug.xcconfig"; sourceTree = ""; }; + 58826CD63BA62F9235CFF40A /* Pods-FileBrowser.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.release.xcconfig"; sourceTree = ""; }; + B3C408ADAB2383F0BA0267CB /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B3F649B872F1DCC05182CC35 /* Pods-FileBrowserTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.debug.xcconfig"; sourceTree = ""; }; + C3368F3E1E167F4F003F4664 /* Podfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = ""; }; C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; - E6FDD9CBB6EE93AE14F27395 /* Pods-FileBrowserTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -98,7 +99,7 @@ files = ( 343C447F1C73D06200D874FB /* WebKit.framework in Frameworks */, 3439AB6A1C6FC6D90058AF04 /* QuickLook.framework in Frameworks */, - EF625EC2B40CCCD7D8AE971D /* Pods_FileBrowser.framework in Frameworks */, + 3E12044451B65836D3C0CF56 /* Pods_FileBrowser.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -107,7 +108,7 @@ buildActionMask = 2147483647; files = ( 3441695F1C67812400B93D28 /* FileBrowser.framework in Frameworks */, - F3C66B149062BD5D82C379DC /* Pods_FileBrowserTests.framework in Frameworks */, + 0E0A64E33C26BE2270A6BB6C /* Pods_FileBrowserTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -152,8 +153,8 @@ 344169561C67812400B93D28 /* FileBrowser */, 344169621C67812400B93D28 /* FileBrowserTests */, 344169551C67812400B93D28 /* Products */, - 452DB66C2A4A48D8CA2D5E60 /* Pods */, - 807D06ADA8076AE9110E4D9E /* Frameworks */, + B3691842C4B0FA7538B7E8C0 /* Pods */, + E4C334F638013A688EC276F3 /* Frameworks */, ); sourceTree = ""; }; @@ -218,22 +219,23 @@ path = Resources; sourceTree = ""; }; - 452DB66C2A4A48D8CA2D5E60 /* Pods */ = { + B3691842C4B0FA7538B7E8C0 /* Pods */ = { isa = PBXGroup; children = ( - 2CBAFA7DCC17F15DC19F29F9 /* Pods-FileBrowser.debug.xcconfig */, - 4E57A3FC58731598296113AA /* Pods-FileBrowser.release.xcconfig */, - 9D627F86DA38E02397C44242 /* Pods-FileBrowserTests.debug.xcconfig */, - E6FDD9CBB6EE93AE14F27395 /* Pods-FileBrowserTests.release.xcconfig */, + C3368F3E1E167F4F003F4664 /* Podfile */, + 1941D49CA1D047E57A6ADA64 /* Pods-FileBrowser.debug.xcconfig */, + 58826CD63BA62F9235CFF40A /* Pods-FileBrowser.release.xcconfig */, + B3F649B872F1DCC05182CC35 /* Pods-FileBrowserTests.debug.xcconfig */, + 2C1FFB480907B56FC27CAFBC /* Pods-FileBrowserTests.release.xcconfig */, ); name = Pods; sourceTree = ""; }; - 807D06ADA8076AE9110E4D9E /* Frameworks */ = { + E4C334F638013A688EC276F3 /* Frameworks */ = { isa = PBXGroup; children = ( - 2DF06627E7F943CB447A98B0 /* Pods_FileBrowser.framework */, - 05BE57F81A542CF1F59ECC5E /* Pods_FileBrowserTests.framework */, + B3C408ADAB2383F0BA0267CB /* Pods_FileBrowser.framework */, + 290072F7AB49D8F2507666FE /* Pods_FileBrowserTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -256,12 +258,12 @@ isa = PBXNativeTarget; buildConfigurationList = 344169681C67812400B93D28 /* Build configuration list for PBXNativeTarget "FileBrowser" */; buildPhases = ( - 97F2276185606A530E48022A /* [CP] Check Pods Manifest.lock */, + F0FB03D9978AF1692C8745C1 /* [CP] Check Pods Manifest.lock */, 3441694F1C67812400B93D28 /* Sources */, 344169501C67812400B93D28 /* Frameworks */, 344169511C67812400B93D28 /* Headers */, 344169521C67812400B93D28 /* Resources */, - 32CABE09ABE7D7FC20459F67 /* [CP] Copy Pods Resources */, + DDFA27FE81AE772CACC5CE70 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -276,12 +278,12 @@ isa = PBXNativeTarget; buildConfigurationList = 3441696B1C67812400B93D28 /* Build configuration list for PBXNativeTarget "FileBrowserTests" */; buildPhases = ( - 7DD199DB9CF8B53ECE58398F /* [CP] Check Pods Manifest.lock */, + 3C061DD09DB29F695B038E13 /* [CP] Check Pods Manifest.lock */, 3441695A1C67812400B93D28 /* Sources */, 3441695B1C67812400B93D28 /* Frameworks */, 3441695C1C67812400B93D28 /* Resources */, - 2A9CF224D87561AA2418C6A3 /* [CP] Embed Pods Frameworks */, - 10725DD9F99E84C93C02370B /* [CP] Copy Pods Resources */, + 1D65A18D1180D2E5936A4A09 /* [CP] Embed Pods Frameworks */, + 8CC25DB940A007584CEB9761 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -362,37 +364,37 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 10725DD9F99E84C93C02370B /* [CP] Copy Pods Resources */ = { + 1D65A18D1180D2E5936A4A09 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 2A9CF224D87561AA2418C6A3 /* [CP] Embed Pods Frameworks */ = { + 3C061DD09DB29F695B038E13 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - 32CABE09ABE7D7FC20459F67 /* [CP] Copy Pods Resources */ = { + 8CC25DB940A007584CEB9761 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -404,25 +406,25 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 7DD199DB9CF8B53ECE58398F /* [CP] Check Pods Manifest.lock */ = { + DDFA27FE81AE772CACC5CE70 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 97F2276185606A530E48022A /* [CP] Check Pods Manifest.lock */ = { + F0FB03D9978AF1692C8745C1 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -497,8 +499,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 6; DEBUG_INFORMATION_FORMAT = dwarf; @@ -548,8 +548,6 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 6; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -576,7 +574,7 @@ }; 344169691C67812400B93D28 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2CBAFA7DCC17F15DC19F29F9 /* Pods-FileBrowser.debug.xcconfig */; + baseConfigurationReference = 1941D49CA1D047E57A6ADA64 /* Pods-FileBrowser.debug.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -598,7 +596,7 @@ }; 3441696A1C67812400B93D28 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4E57A3FC58731598296113AA /* Pods-FileBrowser.release.xcconfig */; + baseConfigurationReference = 58826CD63BA62F9235CFF40A /* Pods-FileBrowser.release.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -619,7 +617,7 @@ }; 3441696C1C67812400B93D28 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9D627F86DA38E02397C44242 /* Pods-FileBrowserTests.debug.xcconfig */; + baseConfigurationReference = B3F649B872F1DCC05182CC35 /* Pods-FileBrowserTests.debug.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FileBrowserTests/Info.plist; @@ -632,7 +630,7 @@ }; 3441696D1C67812400B93D28 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E6FDD9CBB6EE93AE14F27395 /* Pods-FileBrowserTests.release.xcconfig */; + baseConfigurationReference = 2C1FFB480907B56FC27CAFBC /* Pods-FileBrowserTests.release.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FileBrowserTests/Info.plist; diff --git a/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata b/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata index 8d9274f..acb1c80 100644 --- a/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata +++ b/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata @@ -8,9 +8,9 @@ location = "group:FileBrowser.xcodeproj"> + location = "group:examples/Sample/Pods/Pods.xcodeproj"> + location = "group:Pods/Pods.xcodeproj"> diff --git a/Podfile b/Podfile index 034c48c..482c38c 100644 --- a/Podfile +++ b/Podfile @@ -18,3 +18,13 @@ target 'FileBrowser' do end end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = "" + config.build_settings['CODE_SIGNING_REQUIRED'] = "NO" + config.build_settings['CODE_SIGNING_ALLOWED'] = "NO" + end + end +end diff --git a/Podfile.lock b/Podfile.lock index 952ff8f..5530a59 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -7,6 +7,6 @@ DEPENDENCIES: SPEC CHECKSUMS: Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe -PODFILE CHECKSUM: 79a6ed7d2e5f0fd6c5680daf3c5eb5fa3e540292 +PODFILE CHECKSUM: 0b619a6901aba4d1cd7db4a9d74ea5f0acb072a6 COCOAPODS: 1.1.1 diff --git a/examples/Sample/Podfile b/examples/Sample/Podfile index 948d4fd..1fa33b7 100644 --- a/examples/Sample/Podfile +++ b/examples/Sample/Podfile @@ -2,8 +2,9 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, "8.0" use_frameworks! -workspace 'FileBrowser' #'../../FileBrowserWorkspace' +project 'Sample' +workspace '../../FileBrowserWorkspace' target 'Sample' do - pod 'FileBrowser', :path => '../..' + pod 'FileBrowser', :path => '../../FileBrowser.podspec' end diff --git a/examples/Sample/Podfile.lock b/examples/Sample/Podfile.lock index 841fccd..47fb35b 100644 --- a/examples/Sample/Podfile.lock +++ b/examples/Sample/Podfile.lock @@ -4,16 +4,16 @@ PODS: - Alamofire (~> 4.0) DEPENDENCIES: - - FileBrowser (from `../..`) + - FileBrowser (from `../../FileBrowser.podspec`) EXTERNAL SOURCES: FileBrowser: - :path: "../.." + :path: "../../FileBrowser.podspec" SPEC CHECKSUMS: Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe FileBrowser: f4e75766110f2cce2f68de8fcd4a3bc821748c80 -PODFILE CHECKSUM: 57f48c9221084d5581049b0789375ff710d2d560 +PODFILE CHECKSUM: ca61a48c4a562caf636cf07a5f677bfee5b56184 COCOAPODS: 1.1.1 diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index ecfa959..3d56bcb 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -16,11 +16,11 @@ 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CA1D8C546000C443D3 /* BB8.jpg */; }; 48A199CF1D8C546000C443D3 /* Images.zip in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CB1D8C546000C443D3 /* Images.zip */; }; 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CC1D8C546000C443D3 /* Stitch.jpg */; }; + 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */; }; + C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3368F3C1E167B91003F4664 /* FileBrowser.framework */; }; C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */; }; C3BF0E061E1563F10009D12C /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E051E1563F10009D12C /* Podfile */; }; - C3BF0E0C1E15723A0009D12C /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */; }; C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E0F1E1591DC0009D12C /* folderContent.json */; }; - CA1A267CE65797AC47128D97 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4492ECEB106C60695FBD72D5 /* Pods_Sample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -37,8 +37,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 10BC242BACC546476B0DAD18 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; - 4492ECEB106C60695FBD72D5 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; 48A199AD1D8C53AC00C443D3 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48A199B51D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48A199B71D8C53AC00C443D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -51,14 +50,14 @@ 48A199CB1D8C546000C443D3 /* Images.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Images.zip; sourceTree = ""; }; 48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; 48A24C321D8C59250044C697 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + C3368F3C1E167B91003F4664 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDataSource.swift; sourceTree = ""; }; - C3BF0E051E1563F10009D12C /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; }; + C3BF0E051E1563F10009D12C /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; C3BF0E071E156BE60009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; - C3BF0E091E156C0A0009D12C /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_FileBrowser.framework; path = "/Users/carl/Developer/FileBrowser/Pods/../build/Debug-iphoneos/Pods_FileBrowser.framework"; sourceTree = ""; }; C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; - C3BF0E0D1E1572530009D12C /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_FileBrowser.framework; path = "/Users/carl/Developer/FileBrowser/Pods/../build/Debug-iphoneos/Pods_FileBrowser.framework"; sourceTree = ""; }; C3BF0E0F1E1591DC0009D12C /* folderContent.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = folderContent.json; sourceTree = ""; }; - E0892FCFB758A36A235DCF55 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; + D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -66,31 +65,22 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3BF0E0C1E15723A0009D12C /* FileBrowser.framework in Frameworks */, - CA1A267CE65797AC47128D97 /* Pods_Sample.framework in Frameworks */, + C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */, + 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 222063E52114BD683D3CB257 /* Pods */ = { - isa = PBXGroup; - children = ( - C3BF0E051E1563F10009D12C /* Podfile */, - E0892FCFB758A36A235DCF55 /* Pods-Sample.debug.xcconfig */, - 10BC242BACC546476B0DAD18 /* Pods-Sample.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; 48A199A41D8C53AC00C443D3 = { isa = PBXGroup; children = ( 48A199AF1D8C53AC00C443D3 /* Sample */, 48A199AE1D8C53AC00C443D3 /* Products */, 48A24C2F1D8C57390044C697 /* Frameworks */, - 222063E52114BD683D3CB257 /* Pods */, + C3BF0E051E1563F10009D12C /* Podfile */, + 7941567C86F4C287F933E7D4 /* Pods */, ); sourceTree = ""; }; @@ -148,16 +138,24 @@ 48A24C2F1D8C57390044C697 /* Frameworks */ = { isa = PBXGroup; children = ( - C3BF0E0D1E1572530009D12C /* Pods_FileBrowser.framework */, + C3368F3C1E167B91003F4664 /* FileBrowser.framework */, C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */, - C3BF0E091E156C0A0009D12C /* Pods_FileBrowser.framework */, C3BF0E071E156BE60009D12C /* FileBrowser.framework */, 48A24C321D8C59250044C697 /* FileBrowser.framework */, - 4492ECEB106C60695FBD72D5 /* Pods_Sample.framework */, + D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */, ); name = Frameworks; sourceTree = ""; }; + 7941567C86F4C287F933E7D4 /* Pods */ = { + isa = PBXGroup; + children = ( + 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */, + FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -165,13 +163,13 @@ isa = PBXNativeTarget; buildConfigurationList = 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( - 2C1B40A688D6C00931B72750 /* [CP] Check Pods Manifest.lock */, + FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */, 48A199A91D8C53AC00C443D3 /* Sources */, 48A199AA1D8C53AC00C443D3 /* Frameworks */, 48A199AB1D8C53AC00C443D3 /* Resources */, 48A199DD1D8C564100C443D3 /* Embed Frameworks */, - 8D2CAA50D1ABB5C35AAE68CA /* [CP] Embed Pods Frameworks */, - 0077E0574CB309911BBE72D7 /* [CP] Copy Pods Resources */, + E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */, + 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -237,7 +235,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0077E0574CB309911BBE72D7 /* [CP] Copy Pods Resources */ = { + 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -252,34 +250,34 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 2C1B40A688D6C00931B72750 /* [CP] Check Pods Manifest.lock */ = { + E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 8D2CAA50D1ABB5C35AAE68CA /* [CP] Embed Pods Frameworks */ = { + FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -412,7 +410,7 @@ }; 48A199C01D8C53AC00C443D3 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E0892FCFB758A36A235DCF55 /* Pods-Sample.debug.xcconfig */; + baseConfigurationReference = 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -429,7 +427,7 @@ }; 48A199C11D8C53AC00C443D3 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 10BC242BACC546476B0DAD18 /* Pods-Sample.release.xcconfig */; + baseConfigurationReference = FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; From 47a8b8928b06c26a29af101bcb2835ccccf3f6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 13:07:04 +0100 Subject: [PATCH 12/36] Update travis.yml to install main pods --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e1e0f7f..887ad40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ env: before_install: - gem install cocoapods --pre - xcrun simctl list -install: echo "<3" +install: pod install env: - MODE=framework - MODE=examples From de480d7c12f6ef61bbbd66599321bbdf94d979ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 13:12:57 +0100 Subject: [PATCH 13/36] Add spec source to Podfile --- Podfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Podfile b/Podfile index 482c38c..6bf6f59 100644 --- a/Podfile +++ b/Podfile @@ -1,3 +1,5 @@ +source 'https://github.com/CocoaPods/Specs.git' + # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' From 4780a34f32e1a59979a0f4d3819972b865e32a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 13:18:26 +0100 Subject: [PATCH 14/36] Add pod repo update to .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 887ad40..e10fc00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ env: before_install: - gem install cocoapods --pre - xcrun simctl list + - pod repo update install: pod install env: - MODE=framework From 2c7c00a5811fda342ec8cc2b7c4f948ce35172e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 18:22:44 +0100 Subject: [PATCH 15/36] Use sepatate workspace for sample app --- examples/Sample/Podfile | 2 +- examples/Sample/Podfile.lock | 2 +- .../Sample/Sample.xcodeproj/project.pbxproj | 44 +++++++++---------- .../contents.xcworkspacedata | 10 +++++ 4 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 examples/Sample/Sample.xcworkspace/contents.xcworkspacedata diff --git a/examples/Sample/Podfile b/examples/Sample/Podfile index 1fa33b7..4324b8d 100644 --- a/examples/Sample/Podfile +++ b/examples/Sample/Podfile @@ -3,7 +3,7 @@ platform :ios, "8.0" use_frameworks! project 'Sample' -workspace '../../FileBrowserWorkspace' +# workspace '../../FileBrowserWorkspace' target 'Sample' do pod 'FileBrowser', :path => '../../FileBrowser.podspec' diff --git a/examples/Sample/Podfile.lock b/examples/Sample/Podfile.lock index 47fb35b..56571a7 100644 --- a/examples/Sample/Podfile.lock +++ b/examples/Sample/Podfile.lock @@ -14,6 +14,6 @@ SPEC CHECKSUMS: Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe FileBrowser: f4e75766110f2cce2f68de8fcd4a3bc821748c80 -PODFILE CHECKSUM: ca61a48c4a562caf636cf07a5f677bfee5b56184 +PODFILE CHECKSUM: 89b602114a6137a17b342c624bbed635b89d7a0e COCOAPODS: 1.1.1 diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 3d56bcb..81544a7 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -16,11 +16,11 @@ 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CA1D8C546000C443D3 /* BB8.jpg */; }; 48A199CF1D8C546000C443D3 /* Images.zip in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CB1D8C546000C443D3 /* Images.zip */; }; 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CC1D8C546000C443D3 /* Stitch.jpg */; }; - 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */; }; C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3368F3C1E167B91003F4664 /* FileBrowser.framework */; }; C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */; }; C3BF0E061E1563F10009D12C /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E051E1563F10009D12C /* Podfile */; }; C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E0F1E1591DC0009D12C /* folderContent.json */; }; + CB3FBD6E515F4D5270909E05 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9AFED70712756269C8411A2 /* Pods_Sample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -37,7 +37,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; 48A199AD1D8C53AC00C443D3 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48A199B51D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48A199B71D8C53AC00C443D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -50,14 +49,15 @@ 48A199CB1D8C546000C443D3 /* Images.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Images.zip; sourceTree = ""; }; 48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; 48A24C321D8C59250044C697 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + 5C6F647894F9C3F73E521F72 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; + 78F7443CF377AB4C73185204 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; C3368F3C1E167B91003F4664 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDataSource.swift; sourceTree = ""; }; C3BF0E051E1563F10009D12C /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; C3BF0E071E156BE60009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0E0F1E1591DC0009D12C /* folderContent.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = folderContent.json; sourceTree = ""; }; - D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; + C9AFED70712756269C8411A2 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -66,7 +66,7 @@ buildActionMask = 2147483647; files = ( C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */, - 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */, + CB3FBD6E515F4D5270909E05 /* Pods_Sample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -80,7 +80,7 @@ 48A199AE1D8C53AC00C443D3 /* Products */, 48A24C2F1D8C57390044C697 /* Frameworks */, C3BF0E051E1563F10009D12C /* Podfile */, - 7941567C86F4C287F933E7D4 /* Pods */, + 4CA91A1C07C917426D9BA9C7 /* Pods */, ); sourceTree = ""; }; @@ -142,16 +142,16 @@ C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */, C3BF0E071E156BE60009D12C /* FileBrowser.framework */, 48A24C321D8C59250044C697 /* FileBrowser.framework */, - D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */, + C9AFED70712756269C8411A2 /* Pods_Sample.framework */, ); name = Frameworks; sourceTree = ""; }; - 7941567C86F4C287F933E7D4 /* Pods */ = { + 4CA91A1C07C917426D9BA9C7 /* Pods */ = { isa = PBXGroup; children = ( - 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */, - FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */, + 5C6F647894F9C3F73E521F72 /* Pods-Sample.debug.xcconfig */, + 78F7443CF377AB4C73185204 /* Pods-Sample.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -163,13 +163,13 @@ isa = PBXNativeTarget; buildConfigurationList = 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( - FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */, + 117790000FDCD2E9548AA948 /* [CP] Check Pods Manifest.lock */, 48A199A91D8C53AC00C443D3 /* Sources */, 48A199AA1D8C53AC00C443D3 /* Frameworks */, 48A199AB1D8C53AC00C443D3 /* Resources */, 48A199DD1D8C564100C443D3 /* Embed Frameworks */, - E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */, - 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */, + BE7E038D141D4280EA132CFE /* [CP] Embed Pods Frameworks */, + 064902EF2BE3C866A1E65AD5 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -235,7 +235,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */ = { + 064902EF2BE3C866A1E65AD5 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -250,34 +250,34 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */ = { + 117790000FDCD2E9548AA948 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */ = { + BE7E038D141D4280EA132CFE /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -410,7 +410,7 @@ }; 48A199C01D8C53AC00C443D3 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */; + baseConfigurationReference = 5C6F647894F9C3F73E521F72 /* Pods-Sample.debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -427,7 +427,7 @@ }; 48A199C11D8C53AC00C443D3 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */; + baseConfigurationReference = 78F7443CF377AB4C73185204 /* Pods-Sample.release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; diff --git a/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata b/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..7b5a2f3 --- /dev/null +++ b/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + From 354cc50872ec207461a3baf1c84efcd4f83ba7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 18:52:12 +0100 Subject: [PATCH 16/36] Update pods --- FileBrowser.xcodeproj/project.pbxproj | 84 +++++++++---------- .../contents.xcworkspacedata | 3 - Podfile.lock | 2 +- 3 files changed, 43 insertions(+), 46 deletions(-) diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 738b280..241a185 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 0E0A64E33C26BE2270A6BB6C /* Pods_FileBrowserTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 290072F7AB49D8F2507666FE /* Pods_FileBrowserTests.framework */; }; 3437405B1C6E7DA50090FD6A /* FileListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */; }; 3439AB681C6F203A0058AF04 /* FileParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3439AB671C6F203A0058AF04 /* FileParser.swift */; }; 3439AB6A1C6FC6D90058AF04 /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3439AB691C6FC6D90058AF04 /* QuickLook.framework */; settings = {ATTRIBUTES = (Required, ); }; }; @@ -34,7 +33,8 @@ 349A12361C707E86005435C0 /* image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A122F1C707E86005435C0 /* image@2x.png */; }; 349A12371C707E86005435C0 /* pdf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* pdf@2x.png */; }; 349A12381C707E86005435C0 /* zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* zip@2x.png */; }; - 3E12044451B65836D3C0CF56 /* Pods_FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3C408ADAB2383F0BA0267CB /* Pods_FileBrowser.framework */; }; + 407A5EB3D9E4D3CB89F8CE62 /* Pods_FileBrowserTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8256F4951A29AA08EEE848D /* Pods_FileBrowserTests.framework */; }; + B97D1489A3328A8328CA8445 /* Pods_FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B6BC2679EB05CBC5A0BEBB0 /* Pods_FileBrowser.framework */; }; C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; }; @@ -51,9 +51,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1941D49CA1D047E57A6ADA64 /* Pods-FileBrowser.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.debug.xcconfig"; sourceTree = ""; }; - 290072F7AB49D8F2507666FE /* Pods_FileBrowserTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowserTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2C1FFB480907B56FC27CAFBC /* Pods-FileBrowserTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.release.xcconfig"; sourceTree = ""; }; + 1B6BC2679EB05CBC5A0BEBB0 /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 3439AB671C6F203A0058AF04 /* FileParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileParser.swift; sourceTree = ""; }; 3439AB691C6FC6D90058AF04 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; }; @@ -83,13 +81,15 @@ 349A122F1C707E86005435C0 /* image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image@2x.png"; sourceTree = ""; }; 349A12301C707E86005435C0 /* pdf@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pdf@2x.png"; sourceTree = ""; }; 349A12311C707E86005435C0 /* zip@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zip@2x.png"; sourceTree = ""; }; - 58826CD63BA62F9235CFF40A /* Pods-FileBrowser.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.release.xcconfig"; sourceTree = ""; }; - B3C408ADAB2383F0BA0267CB /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - B3F649B872F1DCC05182CC35 /* Pods-FileBrowserTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.debug.xcconfig"; sourceTree = ""; }; + 4E0A538821E701F0CCAD763D /* Pods-FileBrowser.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.release.xcconfig"; sourceTree = ""; }; + 648D2F3FED320E93B858B970 /* Pods-FileBrowser.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.debug.xcconfig"; sourceTree = ""; }; + 6A8FCF7A82995BC7CD8F3BA6 /* Pods-FileBrowserTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.debug.xcconfig"; sourceTree = ""; }; + BECB9C63D84BD6F3A7EDFFE5 /* Pods-FileBrowserTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.release.xcconfig"; sourceTree = ""; }; C3368F3E1E167F4F003F4664 /* Podfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = ""; }; C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; + D8256F4951A29AA08EEE848D /* Pods_FileBrowserTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowserTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -99,7 +99,7 @@ files = ( 343C447F1C73D06200D874FB /* WebKit.framework in Frameworks */, 3439AB6A1C6FC6D90058AF04 /* QuickLook.framework in Frameworks */, - 3E12044451B65836D3C0CF56 /* Pods_FileBrowser.framework in Frameworks */, + B97D1489A3328A8328CA8445 /* Pods_FileBrowser.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -108,7 +108,7 @@ buildActionMask = 2147483647; files = ( 3441695F1C67812400B93D28 /* FileBrowser.framework in Frameworks */, - 0E0A64E33C26BE2270A6BB6C /* Pods_FileBrowserTests.framework in Frameworks */, + 407A5EB3D9E4D3CB89F8CE62 /* Pods_FileBrowserTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -154,7 +154,7 @@ 344169621C67812400B93D28 /* FileBrowserTests */, 344169551C67812400B93D28 /* Products */, B3691842C4B0FA7538B7E8C0 /* Pods */, - E4C334F638013A688EC276F3 /* Frameworks */, + 85667C7D65B4F0588C86FD9F /* Frameworks */, ); sourceTree = ""; }; @@ -219,25 +219,25 @@ path = Resources; sourceTree = ""; }; - B3691842C4B0FA7538B7E8C0 /* Pods */ = { + 85667C7D65B4F0588C86FD9F /* Frameworks */ = { isa = PBXGroup; children = ( - C3368F3E1E167F4F003F4664 /* Podfile */, - 1941D49CA1D047E57A6ADA64 /* Pods-FileBrowser.debug.xcconfig */, - 58826CD63BA62F9235CFF40A /* Pods-FileBrowser.release.xcconfig */, - B3F649B872F1DCC05182CC35 /* Pods-FileBrowserTests.debug.xcconfig */, - 2C1FFB480907B56FC27CAFBC /* Pods-FileBrowserTests.release.xcconfig */, + 1B6BC2679EB05CBC5A0BEBB0 /* Pods_FileBrowser.framework */, + D8256F4951A29AA08EEE848D /* Pods_FileBrowserTests.framework */, ); - name = Pods; + name = Frameworks; sourceTree = ""; }; - E4C334F638013A688EC276F3 /* Frameworks */ = { + B3691842C4B0FA7538B7E8C0 /* Pods */ = { isa = PBXGroup; children = ( - B3C408ADAB2383F0BA0267CB /* Pods_FileBrowser.framework */, - 290072F7AB49D8F2507666FE /* Pods_FileBrowserTests.framework */, + C3368F3E1E167F4F003F4664 /* Podfile */, + 648D2F3FED320E93B858B970 /* Pods-FileBrowser.debug.xcconfig */, + 4E0A538821E701F0CCAD763D /* Pods-FileBrowser.release.xcconfig */, + 6A8FCF7A82995BC7CD8F3BA6 /* Pods-FileBrowserTests.debug.xcconfig */, + BECB9C63D84BD6F3A7EDFFE5 /* Pods-FileBrowserTests.release.xcconfig */, ); - name = Frameworks; + name = Pods; sourceTree = ""; }; /* End PBXGroup section */ @@ -258,12 +258,12 @@ isa = PBXNativeTarget; buildConfigurationList = 344169681C67812400B93D28 /* Build configuration list for PBXNativeTarget "FileBrowser" */; buildPhases = ( - F0FB03D9978AF1692C8745C1 /* [CP] Check Pods Manifest.lock */, + 59FAE2C2886D32634722FCC0 /* [CP] Check Pods Manifest.lock */, 3441694F1C67812400B93D28 /* Sources */, 344169501C67812400B93D28 /* Frameworks */, 344169511C67812400B93D28 /* Headers */, 344169521C67812400B93D28 /* Resources */, - DDFA27FE81AE772CACC5CE70 /* [CP] Copy Pods Resources */, + 5D170C8EDB75EA70CCCCB2AB /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -278,12 +278,12 @@ isa = PBXNativeTarget; buildConfigurationList = 3441696B1C67812400B93D28 /* Build configuration list for PBXNativeTarget "FileBrowserTests" */; buildPhases = ( - 3C061DD09DB29F695B038E13 /* [CP] Check Pods Manifest.lock */, + 976D80E6F1CD9041356C171B /* [CP] Check Pods Manifest.lock */, 3441695A1C67812400B93D28 /* Sources */, 3441695B1C67812400B93D28 /* Frameworks */, 3441695C1C67812400B93D28 /* Resources */, - 1D65A18D1180D2E5936A4A09 /* [CP] Embed Pods Frameworks */, - 8CC25DB940A007584CEB9761 /* [CP] Copy Pods Resources */, + 6DA0344E8E5BBF9ECD90AC50 /* [CP] Embed Pods Frameworks */, + 6A93A5125EC4D03229A99F64 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -364,37 +364,37 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1D65A18D1180D2E5936A4A09 /* [CP] Embed Pods Frameworks */ = { + 59FAE2C2886D32634722FCC0 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - 3C061DD09DB29F695B038E13 /* [CP] Check Pods Manifest.lock */ = { + 5D170C8EDB75EA70CCCCB2AB /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 8CC25DB940A007584CEB9761 /* [CP] Copy Pods Resources */ = { + 6A93A5125EC4D03229A99F64 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -409,22 +409,22 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - DDFA27FE81AE772CACC5CE70 /* [CP] Copy Pods Resources */ = { + 6DA0344E8E5BBF9ECD90AC50 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - F0FB03D9978AF1692C8745C1 /* [CP] Check Pods Manifest.lock */ = { + 976D80E6F1CD9041356C171B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -574,7 +574,7 @@ }; 344169691C67812400B93D28 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1941D49CA1D047E57A6ADA64 /* Pods-FileBrowser.debug.xcconfig */; + baseConfigurationReference = 648D2F3FED320E93B858B970 /* Pods-FileBrowser.debug.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -596,7 +596,7 @@ }; 3441696A1C67812400B93D28 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 58826CD63BA62F9235CFF40A /* Pods-FileBrowser.release.xcconfig */; + baseConfigurationReference = 4E0A538821E701F0CCAD763D /* Pods-FileBrowser.release.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -617,7 +617,7 @@ }; 3441696C1C67812400B93D28 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B3F649B872F1DCC05182CC35 /* Pods-FileBrowserTests.debug.xcconfig */; + baseConfigurationReference = 6A8FCF7A82995BC7CD8F3BA6 /* Pods-FileBrowserTests.debug.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FileBrowserTests/Info.plist; @@ -630,7 +630,7 @@ }; 3441696D1C67812400B93D28 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2C1FFB480907B56FC27CAFBC /* Pods-FileBrowserTests.release.xcconfig */; + baseConfigurationReference = BECB9C63D84BD6F3A7EDFFE5 /* Pods-FileBrowserTests.release.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FileBrowserTests/Info.plist; diff --git a/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata b/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata index acb1c80..521ae35 100644 --- a/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata +++ b/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata @@ -7,9 +7,6 @@ - - diff --git a/Podfile.lock b/Podfile.lock index 5530a59..3d6b748 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -7,6 +7,6 @@ DEPENDENCIES: SPEC CHECKSUMS: Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe -PODFILE CHECKSUM: 0b619a6901aba4d1cd7db4a9d74ea5f0acb072a6 +PODFILE CHECKSUM: 1ae72b3bc7be66193c8e11080fe9fa2324cc44b0 COCOAPODS: 1.1.1 From 31c1a914f4a5b426324fb47ce1176c48ae0c532a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Fri, 30 Dec 2016 18:52:27 +0100 Subject: [PATCH 17/36] Fix build settings --- .travis.yml | 2 +- build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e10fc00..4c7f1c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ env: before_install: - gem install cocoapods --pre - xcrun simctl list - - pod repo update + - pod repo update --silent install: pod install env: - MODE=framework diff --git a/build.sh b/build.sh index f74f989..f727ae8 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ MODE="$1" if [ "$MODE" = "framework" ]; then echo "Building and testing FileBrowser." xcodebuild \ - -project FileBrowser.xcodeproj \ + -workspace FileBrowserWorkspace.xcworkspace \ -scheme FileBrowser \ -sdk "$SDK" \ -destination "$PLATFORM" \ From e7e09c34dbb6f8a1844a84f3033884ba45dc2a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 1 Jan 2017 16:44:18 +0100 Subject: [PATCH 18/36] Implement asynchronous loading of directory content --- FileBrowser/FileBrowserDataSource.swift | 3 +- FileBrowser/FileListViewController.swift | 29 +++++++++--- FileBrowser/FileParser.swift | 44 +++++++++++-------- .../Sample/Sample.xcodeproj/project.pbxproj | 2 +- examples/Sample/Sample/CustomDataSource.swift | 21 ++++----- 5 files changed, 60 insertions(+), 39 deletions(-) diff --git a/FileBrowser/FileBrowserDataSource.swift b/FileBrowser/FileBrowserDataSource.swift index aab427f..bf95244 100644 --- a/FileBrowser/FileBrowserDataSource.swift +++ b/FileBrowser/FileBrowserDataSource.swift @@ -10,7 +10,8 @@ import Foundation public protocol FileBrowserDataSource { var rootDirectory: FBFile { get } - func contents(ofDirectory directory: FBFile) throws -> [FBFile] + func provideContents(ofDirectory directory: FBFile, callback: @escaping ([FBFile]?, Error?) -> ()) + func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? func data(forFile file: FBFile) throws -> Data func dataURL(forFile file: FBFile) throws -> URL diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index c5d5a9d..d2dbdcc 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -69,13 +69,19 @@ class FileListViewController: UIViewController { override func viewDidLoad() { + showActivityIndicator() + // Prepare data - do { - files = try dataSource.contents(ofDirectory: self.directory) - indexFiles() - } catch let error { - // TODO: error handling - print(error.localizedDescription) + dataSource.provideContents(ofDirectory: self.directory) { result, error in + self.hideActivityIndicator() + if let files = result { + self.files = files + self.indexFiles() + self.tableView.reloadData() + } else { + // TODO: display errors + print(error?.localizedDescription) + } } // Set search bar @@ -129,6 +135,17 @@ class FileListViewController: UIViewController { }) tableView.reloadData() } + + //MARK: activity indicator + func showActivityIndicator() { + let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + self.navigationItem.titleView = activityIndicator + activityIndicator.startAnimating() + } + + func hideActivityIndicator() { + navigationItem.titleView = nil // revert to default (title) + } } diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index b74989a..2695e98 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -7,6 +7,7 @@ // import Foundation +import Result class LocalFileParser: FileBrowserDataSource { @@ -27,28 +28,33 @@ class LocalFileParser: FileBrowserDataSource { return FBFile(path: url) } - func contents(ofDirectory directory: FBFile) throws -> [FBFile] { + func provideContents(ofDirectory directory: FBFile, callback: @escaping ([FBFile]?, Error?) -> ()) { // Get contents - - let filePaths = try self.fileManager.contentsOfDirectory(at: directory.path, includingPropertiesForKeys: [], options: [.skipsHiddenFiles]) - - // Filter - var files = filePaths.map(FBFile.init) - if let excludesFileExtensions = excludesFileExtensions { - let lowercased = excludesFileExtensions.map { $0.lowercased() } - files = files.filter { !lowercased.contains($0.fileExtension?.lowercased() ?? "") } - } - if let excludesFilepaths = excludesFilepaths { - files = files.filter { !excludesFilepaths.contains($0.path) } - } - if excludesWithEmptyFilenames { - files = files.filter { !$0.displayName.isEmpty } + do { + let filePaths = try self.fileManager.contentsOfDirectory(at: directory.path, includingPropertiesForKeys: [], options: [.skipsHiddenFiles]) + + + // Filter + var files = filePaths.map(FBFile.init) + if let excludesFileExtensions = excludesFileExtensions { + let lowercased = excludesFileExtensions.map { $0.lowercased() } + files = files.filter { !lowercased.contains($0.fileExtension?.lowercased() ?? "") } + } + if let excludesFilepaths = excludesFilepaths { + files = files.filter { !excludesFilepaths.contains($0.path) } + } + if excludesWithEmptyFilenames { + files = files.filter { !$0.displayName.isEmpty } + } + + // Sort + files = files.sorted(){$0.displayName < $1.displayName} + callback(files, nil) + } catch let error { + callback(nil, error) + return } - - // Sort - files = files.sorted(){$0.displayName < $1.displayName} - return files } func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? { diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 81544a7..73784b4 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -106,6 +106,7 @@ children = ( 48A199D11D8C546500C443D3 /* Resources */, 48A199C31D8C53DB00C443D3 /* AppDelegate.swift */, + C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */, 48A199C41D8C53DB00C443D3 /* Info.plist */, 48A199B41D8C53AC00C443D3 /* Main.storyboard */, 48A199B71D8C53AC00C443D3 /* Assets.xcassets */, @@ -130,7 +131,6 @@ isa = PBXGroup; children = ( 48A199C71D8C53E200C443D3 /* MainViewController.swift */, - C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */, ); name = "View Controller"; sourceTree = ""; diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index 83db3d7..02ba1d9 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -23,7 +23,7 @@ open class CustomDataSource: FileBrowserDataSource { public var excludesFileExtensions: [String]? = nil public var excludesFilepaths: [URL]? = nil public var excludesWithEmptyFilenames = false - + let rootUrl = URL(string: "/")! public var rootDirectory: FBFile { let file = FBFile(path: rootUrl) @@ -34,9 +34,9 @@ open class CustomDataSource: FileBrowserDataSource { let fileManager = FileManager.default - public func contents(ofDirectory directory: FBFile) throws -> [FBFile] { + open func provideContents(ofDirectory directory: FBFile, callback: @escaping ([FBFile]?, Error?) -> ()) { // traverse the file tree outlined in the JSON file to find the directory - let pathComponents = Array(directory.path.pathComponents.dropFirst()) + let pathComponents = Array(directory.path.pathComponents.dropFirst()) // we're already in the root directory at the root of our json document let directoryDescription = pathComponents.reduce(json) { currentFolder, subfolderName -> KeyValue in let content = currentFolder["content"]! as! KeyValue return content[subfolderName] as! KeyValue @@ -56,7 +56,12 @@ open class CustomDataSource: FileBrowserDataSource { return file } - return files + // simulate loading of remote content + DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: { + callback(files, nil) + }) + + return } public func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? { @@ -69,11 +74,3 @@ open class CustomDataSource: FileBrowserDataSource { } } - -//extension URL { -// func relativeTo(baseUrl: URL) -> URL { -// -// let keep = self.pathComponents.dropFirst(baseUrl.pathComponents.count) -// return keep.fir -// } -//} From 76a58237b89d00b9820bf2f9fed6f74795ae1cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 1 Jan 2017 16:56:17 +0100 Subject: [PATCH 19/36] Add Result enum for callbacks --- FileBrowser.xcodeproj/project.pbxproj | 4 ++++ FileBrowser/FileBrowserDataSource.swift | 2 +- FileBrowser/FileListViewController.swift | 9 +++++---- FileBrowser/FileParser.swift | 7 +++---- FileBrowser/Result.swift | 14 ++++++++++++++ examples/Sample/Sample/CustomDataSource.swift | 4 ++-- 6 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 FileBrowser/Result.swift diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 241a185..21ae49b 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -38,6 +38,7 @@ C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; }; + C3D983CD1E195B9600A8CC06 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D983CC1E195B9600A8CC06 /* Result.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -89,6 +90,7 @@ C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = ""; }; C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; + C3D983CC1E195B9600A8CC06 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; }; D8256F4951A29AA08EEE848D /* Pods_FileBrowserTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowserTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -121,6 +123,7 @@ 3439AB671C6F203A0058AF04 /* FileParser.swift */, 349A12271C707B1A005435C0 /* FBFile.swift */, C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */, + C3D983CC1E195B9600A8CC06 /* Result.swift */, ); name = Data; sourceTree = ""; @@ -447,6 +450,7 @@ buildActionMask = 2147483647; files = ( 343C447A1C73CFC400D874FB /* WebviewPreviewViewContoller.swift in Sources */, + C3D983CD1E195B9600A8CC06 /* Result.swift in Sources */, 3439AB701C6FF68C0058AF04 /* FileBrowser.swift in Sources */, 349A12261C707317005435C0 /* FileListTableView.swift in Sources */, 343C44661C73CD3200D874FB /* PreviewManager.swift in Sources */, diff --git a/FileBrowser/FileBrowserDataSource.swift b/FileBrowser/FileBrowserDataSource.swift index bf95244..c6abdcf 100644 --- a/FileBrowser/FileBrowserDataSource.swift +++ b/FileBrowser/FileBrowserDataSource.swift @@ -10,7 +10,7 @@ import Foundation public protocol FileBrowserDataSource { var rootDirectory: FBFile { get } - func provideContents(ofDirectory directory: FBFile, callback: @escaping ([FBFile]?, Error?) -> ()) + func provideContents(ofDirectory directory: FBFile, callback: @escaping (Result<[FBFile]>) -> ()) func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? func data(forFile file: FBFile) throws -> Data diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index d2dbdcc..78b7996 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -72,15 +72,16 @@ class FileListViewController: UIViewController { showActivityIndicator() // Prepare data - dataSource.provideContents(ofDirectory: self.directory) { result, error in + dataSource.provideContents(ofDirectory: self.directory) { result in self.hideActivityIndicator() - if let files = result { + switch result { + case .success(let files): self.files = files self.indexFiles() self.tableView.reloadData() - } else { + case .error(let error): // TODO: display errors - print(error?.localizedDescription) + print(error.localizedDescription) } } diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index 2695e98..ce125e3 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -7,7 +7,6 @@ // import Foundation -import Result class LocalFileParser: FileBrowserDataSource { @@ -28,7 +27,7 @@ class LocalFileParser: FileBrowserDataSource { return FBFile(path: url) } - func provideContents(ofDirectory directory: FBFile, callback: @escaping ([FBFile]?, Error?) -> ()) { + func provideContents(ofDirectory directory: FBFile, callback: @escaping (Result<[FBFile]>) -> ()) { // Get contents do { @@ -50,9 +49,9 @@ class LocalFileParser: FileBrowserDataSource { // Sort files = files.sorted(){$0.displayName < $1.displayName} - callback(files, nil) + callback(.success(files)) } catch let error { - callback(nil, error) + callback(.error(error)) return } } diff --git a/FileBrowser/Result.swift b/FileBrowser/Result.swift new file mode 100644 index 0000000..d3c9bf1 --- /dev/null +++ b/FileBrowser/Result.swift @@ -0,0 +1,14 @@ +// +// Result.swift +// FileBrowser +// +// Created by Carl Julius Gödecken on 01/01/2017. +// Copyright © 2017 Carl Julius Gödecken. +// + +import Foundation + +public enum Result { + case success(T) + case error(Error) +} diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index 02ba1d9..f85efcc 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -34,7 +34,7 @@ open class CustomDataSource: FileBrowserDataSource { let fileManager = FileManager.default - open func provideContents(ofDirectory directory: FBFile, callback: @escaping ([FBFile]?, Error?) -> ()) { + open func provideContents(ofDirectory directory: FBFile, callback: @escaping (Result<[FBFile]>) -> ()) { // traverse the file tree outlined in the JSON file to find the directory let pathComponents = Array(directory.path.pathComponents.dropFirst()) // we're already in the root directory at the root of our json document let directoryDescription = pathComponents.reduce(json) { currentFolder, subfolderName -> KeyValue in @@ -58,7 +58,7 @@ open class CustomDataSource: FileBrowserDataSource { // simulate loading of remote content DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: { - callback(files, nil) + callback(.success(files)) }) return From 41560d5bdac746e06cc17b32fb2a64d5e7890729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Mon, 2 Jan 2017 15:43:36 +0100 Subject: [PATCH 20/36] Remove activity indicator in FileList --- FileBrowser/FileListViewController.swift | 13 ------------- examples/Sample/Sample/CustomDataSource.swift | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index 78b7996..826041b 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -69,11 +69,8 @@ class FileListViewController: UIViewController { override func viewDidLoad() { - showActivityIndicator() - // Prepare data dataSource.provideContents(ofDirectory: self.directory) { result in - self.hideActivityIndicator() switch result { case .success(let files): self.files = files @@ -137,16 +134,6 @@ class FileListViewController: UIViewController { tableView.reloadData() } - //MARK: activity indicator - func showActivityIndicator() { - let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) - self.navigationItem.titleView = activityIndicator - activityIndicator.startAnimating() - } - - func hideActivityIndicator() { - navigationItem.titleView = nil // revert to default (title) - } } diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index f85efcc..c4da7ec 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -57,7 +57,7 @@ open class CustomDataSource: FileBrowserDataSource { } // simulate loading of remote content - DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.4, execute: { callback(.success(files)) }) From cfd5b7a420199dc2defed3776cd4f58753c34632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 8 Jan 2017 16:10:02 +0100 Subject: [PATCH 21/36] Replace AlamoFire with URLSession --- FileBrowser/LoadingViewController.swift | 63 +++++++++++++++++-------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/FileBrowser/LoadingViewController.swift b/FileBrowser/LoadingViewController.swift index cc0a8f2..bbdcad9 100644 --- a/FileBrowser/LoadingViewController.swift +++ b/FileBrowser/LoadingViewController.swift @@ -7,53 +7,46 @@ // import Foundation -import Alamofire import QuickLook -class LoadingViewController: UIViewController { +class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSessionDataDelegate { //MARK: Lifecycle @IBOutlet var progressView: UIProgressView! + var downloadTask: URLSessionDownloadTask? + var session: URLSession! var file: FBFile! convenience init (file: FBFile) { self.init(nibName: "LoadingViewController", bundle: Bundle(for: LoadingViewController.self)) self.file = file self.title = file.displayName + + let configuration = URLSessionConfiguration.default + session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil) } - var request: DataRequest? +// var request: DataRequest? override func viewDidLoad() { super.viewDidLoad() + print("Test loading") progressView.setProgress(0, animated: false) guard let fileLocation = file.fileLocation else { print("Error: File has no fileLocation set") return } - Alamofire - .request(fileLocation) - .validate() - .downloadProgress { progress in - self.progressView.setProgress(Float(progress.fractionCompleted), animated: true) - } - .responseData { response in - switch response.result { - case .success: - let data = response.data - self.showFile(data: data) - case .failure(let error): - print(error) // TODO: display the error - } - } + + downloadTask = session.downloadTask(with: fileLocation) + downloadTask!.resume() } @IBAction func cancelButtonTapped(_ sender: Any) { - request?.cancel() + downloadTask?.cancel() } func showFile(data: Data?) { @@ -78,5 +71,37 @@ class LoadingViewController: UIViewController { } } } + + func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) { + completionHandler(.allow) + } + func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { + completionHandler(.performDefaultHandling, nil) + } + func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { + print(error?.localizedDescription) + } + func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) { + do { + let data = try Data(contentsOf: location) + self.showFile(data: data) + } catch let error { + print(error) + } + } + + func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) { + let progress = Float(totalBytesWritten / totalBytesExpectedToWrite) + DispatchQueue.main.async { + self.progressView.setProgress(progress, animated: true) + } + } + + func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { + if let error = error { + print(error.localizedDescription) + } + session.finishTasksAndInvalidate() + } } From 871d56ffa1ceab2052a055d0f8143b21d07c79b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 22 Jan 2017 15:50:30 +0100 Subject: [PATCH 22/36] Undo changes made to include pod dependencies --- .travis.yml | 3 +- FileBrowser.podspec | 1 - FileBrowser.xcodeproj/project.pbxproj | 131 +----------------- .../contents.xcworkspacedata | 2 +- Podfile | 32 ----- Podfile.lock | 12 -- build.sh | 2 +- examples/Sample/Podfile | 2 +- examples/Sample/Podfile.lock | 9 +- .../Sample/Sample.xcodeproj/project.pbxproj | 44 +++--- .../contents.xcworkspacedata | 10 -- 11 files changed, 35 insertions(+), 213 deletions(-) delete mode 100644 Podfile delete mode 100644 Podfile.lock delete mode 100644 examples/Sample/Sample.xcworkspace/contents.xcworkspacedata diff --git a/.travis.yml b/.travis.yml index 4c7f1c2..e1e0f7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,7 @@ env: before_install: - gem install cocoapods --pre - xcrun simctl list - - pod repo update --silent -install: pod install +install: echo "<3" env: - MODE=framework - MODE=examples diff --git a/FileBrowser.podspec b/FileBrowser.podspec index 3183bf0..2da9b4c 100644 --- a/FileBrowser.podspec +++ b/FileBrowser.podspec @@ -36,6 +36,5 @@ Pod::Spec.new do |s| # s.public_header_files = 'Pod/Classes/**/*.h' s.frameworks = 'QuickLook', 'WebKit' # s.dependency 'AFNetworking', '~> 2.3' - s.dependency 'Alamofire', '~> 4.0' end diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 21ae49b..f216739 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -33,8 +33,7 @@ 349A12361C707E86005435C0 /* image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A122F1C707E86005435C0 /* image@2x.png */; }; 349A12371C707E86005435C0 /* pdf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* pdf@2x.png */; }; 349A12381C707E86005435C0 /* zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* zip@2x.png */; }; - 407A5EB3D9E4D3CB89F8CE62 /* Pods_FileBrowserTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8256F4951A29AA08EEE848D /* Pods_FileBrowserTests.framework */; }; - B97D1489A3328A8328CA8445 /* Pods_FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B6BC2679EB05CBC5A0BEBB0 /* Pods_FileBrowser.framework */; }; + C3308C8F1E3501BE00F4D125 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3308C8E1E3501BE00F4D125 /* Result.swift */; }; C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; }; @@ -52,8 +51,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1B6BC2679EB05CBC5A0BEBB0 /* Pods_FileBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; + 3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListViewController.swift; sourceTree = ""; }; 3439AB671C6F203A0058AF04 /* FileParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileParser.swift; sourceTree = ""; }; 3439AB691C6FC6D90058AF04 /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = System/Library/Frameworks/QuickLook.framework; sourceTree = SDKROOT; }; 3439AB6B1C6FD6650058AF04 /* FileListPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListPreview.swift; sourceTree = ""; }; @@ -82,16 +80,10 @@ 349A122F1C707E86005435C0 /* image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image@2x.png"; sourceTree = ""; }; 349A12301C707E86005435C0 /* pdf@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pdf@2x.png"; sourceTree = ""; }; 349A12311C707E86005435C0 /* zip@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zip@2x.png"; sourceTree = ""; }; - 4E0A538821E701F0CCAD763D /* Pods-FileBrowser.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.release.xcconfig"; sourceTree = ""; }; - 648D2F3FED320E93B858B970 /* Pods-FileBrowser.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowser.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser.debug.xcconfig"; sourceTree = ""; }; - 6A8FCF7A82995BC7CD8F3BA6 /* Pods-FileBrowserTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.debug.xcconfig"; sourceTree = ""; }; - BECB9C63D84BD6F3A7EDFFE5 /* Pods-FileBrowserTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileBrowserTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests.release.xcconfig"; sourceTree = ""; }; - C3368F3E1E167F4F003F4664 /* Podfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + C3308C8E1E3501BE00F4D125 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; }; C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = ""; }; C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; - C3D983CC1E195B9600A8CC06 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; }; - D8256F4951A29AA08EEE848D /* Pods_FileBrowserTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FileBrowserTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -101,7 +93,6 @@ files = ( 343C447F1C73D06200D874FB /* WebKit.framework in Frameworks */, 3439AB6A1C6FC6D90058AF04 /* QuickLook.framework in Frameworks */, - B97D1489A3328A8328CA8445 /* Pods_FileBrowser.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -110,7 +101,6 @@ buildActionMask = 2147483647; files = ( 3441695F1C67812400B93D28 /* FileBrowser.framework in Frameworks */, - 407A5EB3D9E4D3CB89F8CE62 /* Pods_FileBrowserTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -123,7 +113,7 @@ 3439AB671C6F203A0058AF04 /* FileParser.swift */, 349A12271C707B1A005435C0 /* FBFile.swift */, C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */, - C3D983CC1E195B9600A8CC06 /* Result.swift */, + C3308C8E1E3501BE00F4D125 /* Result.swift */, ); name = Data; sourceTree = ""; @@ -156,8 +146,6 @@ 344169561C67812400B93D28 /* FileBrowser */, 344169621C67812400B93D28 /* FileBrowserTests */, 344169551C67812400B93D28 /* Products */, - B3691842C4B0FA7538B7E8C0 /* Pods */, - 85667C7D65B4F0588C86FD9F /* Frameworks */, ); sourceTree = ""; }; @@ -222,27 +210,6 @@ path = Resources; sourceTree = ""; }; - 85667C7D65B4F0588C86FD9F /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1B6BC2679EB05CBC5A0BEBB0 /* Pods_FileBrowser.framework */, - D8256F4951A29AA08EEE848D /* Pods_FileBrowserTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - B3691842C4B0FA7538B7E8C0 /* Pods */ = { - isa = PBXGroup; - children = ( - C3368F3E1E167F4F003F4664 /* Podfile */, - 648D2F3FED320E93B858B970 /* Pods-FileBrowser.debug.xcconfig */, - 4E0A538821E701F0CCAD763D /* Pods-FileBrowser.release.xcconfig */, - 6A8FCF7A82995BC7CD8F3BA6 /* Pods-FileBrowserTests.debug.xcconfig */, - BECB9C63D84BD6F3A7EDFFE5 /* Pods-FileBrowserTests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -261,12 +228,10 @@ isa = PBXNativeTarget; buildConfigurationList = 344169681C67812400B93D28 /* Build configuration list for PBXNativeTarget "FileBrowser" */; buildPhases = ( - 59FAE2C2886D32634722FCC0 /* [CP] Check Pods Manifest.lock */, 3441694F1C67812400B93D28 /* Sources */, 344169501C67812400B93D28 /* Frameworks */, 344169511C67812400B93D28 /* Headers */, 344169521C67812400B93D28 /* Resources */, - 5D170C8EDB75EA70CCCCB2AB /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -281,12 +246,9 @@ isa = PBXNativeTarget; buildConfigurationList = 3441696B1C67812400B93D28 /* Build configuration list for PBXNativeTarget "FileBrowserTests" */; buildPhases = ( - 976D80E6F1CD9041356C171B /* [CP] Check Pods Manifest.lock */, 3441695A1C67812400B93D28 /* Sources */, 3441695B1C67812400B93D28 /* Frameworks */, 3441695C1C67812400B93D28 /* Resources */, - 6DA0344E8E5BBF9ECD90AC50 /* [CP] Embed Pods Frameworks */, - 6A93A5125EC4D03229A99F64 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -366,93 +328,16 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 59FAE2C2886D32634722FCC0 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 5D170C8EDB75EA70CCCCB2AB /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowser/Pods-FileBrowser-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 6A93A5125EC4D03229A99F64 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 6DA0344E8E5BBF9ECD90AC50 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FileBrowserTests/Pods-FileBrowserTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 976D80E6F1CD9041356C171B /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ 3441694F1C67812400B93D28 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 343C447A1C73CFC400D874FB /* WebviewPreviewViewContoller.swift in Sources */, - C3D983CD1E195B9600A8CC06 /* Result.swift in Sources */, + C3D983CD1E195B9600A8CC06 /* (null) in Sources */, 3439AB701C6FF68C0058AF04 /* FileBrowser.swift in Sources */, 349A12261C707317005435C0 /* FileListTableView.swift in Sources */, + C3308C8F1E3501BE00F4D125 /* Result.swift in Sources */, 343C44661C73CD3200D874FB /* PreviewManager.swift in Sources */, 3439AB681C6F203A0058AF04 /* FileParser.swift in Sources */, 349A12281C707B1A005435C0 /* FBFile.swift in Sources */, @@ -578,7 +463,6 @@ }; 344169691C67812400B93D28 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 648D2F3FED320E93B858B970 /* Pods-FileBrowser.debug.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -600,7 +484,6 @@ }; 3441696A1C67812400B93D28 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4E0A538821E701F0CCAD763D /* Pods-FileBrowser.release.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -621,7 +504,6 @@ }; 3441696C1C67812400B93D28 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 6A8FCF7A82995BC7CD8F3BA6 /* Pods-FileBrowserTests.debug.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FileBrowserTests/Info.plist; @@ -634,7 +516,6 @@ }; 3441696D1C67812400B93D28 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BECB9C63D84BD6F3A7EDFFE5 /* Pods-FileBrowserTests.release.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = FileBrowserTests/Info.plist; diff --git a/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata b/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata index 521ae35..02565c0 100644 --- a/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata +++ b/FileBrowserWorkspace.xcworkspace/contents.xcworkspacedata @@ -8,6 +8,6 @@ location = "group:FileBrowser.xcodeproj"> + location = "group:examples/Sample/Pods/Pods.xcodeproj"> diff --git a/Podfile b/Podfile deleted file mode 100644 index 6bf6f59..0000000 --- a/Podfile +++ /dev/null @@ -1,32 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' - -# Uncomment the next line to define a global platform for your project -# platform :ios, '9.0' - -project 'FileBrowser' -workspace 'FileBrowserWorkspace' - -#link_with 'FileBrowser' -target 'FileBrowser' do - # Comment the next line if you're not using Swift and don't want to use dynamic frameworks - use_frameworks! - - # Pods for FileBrowser - pod 'Alamofire', '~> 4.0' - - target 'FileBrowserTests' do - inherit! :search_paths - # Pods for testing - end - -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = "" - config.build_settings['CODE_SIGNING_REQUIRED'] = "NO" - config.build_settings['CODE_SIGNING_ALLOWED'] = "NO" - end - end -end diff --git a/Podfile.lock b/Podfile.lock deleted file mode 100644 index 3d6b748..0000000 --- a/Podfile.lock +++ /dev/null @@ -1,12 +0,0 @@ -PODS: - - Alamofire (4.2.0) - -DEPENDENCIES: - - Alamofire (~> 4.0) - -SPEC CHECKSUMS: - Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe - -PODFILE CHECKSUM: 1ae72b3bc7be66193c8e11080fe9fa2324cc44b0 - -COCOAPODS: 1.1.1 diff --git a/build.sh b/build.sh index f727ae8..f74f989 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ MODE="$1" if [ "$MODE" = "framework" ]; then echo "Building and testing FileBrowser." xcodebuild \ - -workspace FileBrowserWorkspace.xcworkspace \ + -project FileBrowser.xcodeproj \ -scheme FileBrowser \ -sdk "$SDK" \ -destination "$PLATFORM" \ diff --git a/examples/Sample/Podfile b/examples/Sample/Podfile index 4324b8d..1fa33b7 100644 --- a/examples/Sample/Podfile +++ b/examples/Sample/Podfile @@ -3,7 +3,7 @@ platform :ios, "8.0" use_frameworks! project 'Sample' -# workspace '../../FileBrowserWorkspace' +workspace '../../FileBrowserWorkspace' target 'Sample' do pod 'FileBrowser', :path => '../../FileBrowser.podspec' diff --git a/examples/Sample/Podfile.lock b/examples/Sample/Podfile.lock index 56571a7..161f932 100644 --- a/examples/Sample/Podfile.lock +++ b/examples/Sample/Podfile.lock @@ -1,7 +1,5 @@ PODS: - - Alamofire (4.2.0) - - FileBrowser (0.2.0): - - Alamofire (~> 4.0) + - FileBrowser (0.2.0) DEPENDENCIES: - FileBrowser (from `../../FileBrowser.podspec`) @@ -11,9 +9,8 @@ EXTERNAL SOURCES: :path: "../../FileBrowser.podspec" SPEC CHECKSUMS: - Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe - FileBrowser: f4e75766110f2cce2f68de8fcd4a3bc821748c80 + FileBrowser: af8abc035daca66a6066351ae162c4af4c6b24dd -PODFILE CHECKSUM: 89b602114a6137a17b342c624bbed635b89d7a0e +PODFILE CHECKSUM: ca61a48c4a562caf636cf07a5f677bfee5b56184 COCOAPODS: 1.1.1 diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 73784b4..818131f 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -16,11 +16,11 @@ 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CA1D8C546000C443D3 /* BB8.jpg */; }; 48A199CF1D8C546000C443D3 /* Images.zip in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CB1D8C546000C443D3 /* Images.zip */; }; 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CC1D8C546000C443D3 /* Stitch.jpg */; }; + 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */; }; C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3368F3C1E167B91003F4664 /* FileBrowser.framework */; }; C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */; }; C3BF0E061E1563F10009D12C /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E051E1563F10009D12C /* Podfile */; }; C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E0F1E1591DC0009D12C /* folderContent.json */; }; - CB3FBD6E515F4D5270909E05 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9AFED70712756269C8411A2 /* Pods_Sample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -37,6 +37,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; 48A199AD1D8C53AC00C443D3 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48A199B51D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48A199B71D8C53AC00C443D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -49,15 +50,14 @@ 48A199CB1D8C546000C443D3 /* Images.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Images.zip; sourceTree = ""; }; 48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; 48A24C321D8C59250044C697 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; - 5C6F647894F9C3F73E521F72 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; - 78F7443CF377AB4C73185204 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; C3368F3C1E167B91003F4664 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDataSource.swift; sourceTree = ""; }; C3BF0E051E1563F10009D12C /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; C3BF0E071E156BE60009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0E0F1E1591DC0009D12C /* folderContent.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = folderContent.json; sourceTree = ""; }; - C9AFED70712756269C8411A2 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -66,7 +66,7 @@ buildActionMask = 2147483647; files = ( C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */, - CB3FBD6E515F4D5270909E05 /* Pods_Sample.framework in Frameworks */, + 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -80,7 +80,7 @@ 48A199AE1D8C53AC00C443D3 /* Products */, 48A24C2F1D8C57390044C697 /* Frameworks */, C3BF0E051E1563F10009D12C /* Podfile */, - 4CA91A1C07C917426D9BA9C7 /* Pods */, + 7941567C86F4C287F933E7D4 /* Pods */, ); sourceTree = ""; }; @@ -142,16 +142,16 @@ C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */, C3BF0E071E156BE60009D12C /* FileBrowser.framework */, 48A24C321D8C59250044C697 /* FileBrowser.framework */, - C9AFED70712756269C8411A2 /* Pods_Sample.framework */, + D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */, ); name = Frameworks; sourceTree = ""; }; - 4CA91A1C07C917426D9BA9C7 /* Pods */ = { + 7941567C86F4C287F933E7D4 /* Pods */ = { isa = PBXGroup; children = ( - 5C6F647894F9C3F73E521F72 /* Pods-Sample.debug.xcconfig */, - 78F7443CF377AB4C73185204 /* Pods-Sample.release.xcconfig */, + 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */, + FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -163,13 +163,13 @@ isa = PBXNativeTarget; buildConfigurationList = 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( - 117790000FDCD2E9548AA948 /* [CP] Check Pods Manifest.lock */, + FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */, 48A199A91D8C53AC00C443D3 /* Sources */, 48A199AA1D8C53AC00C443D3 /* Frameworks */, 48A199AB1D8C53AC00C443D3 /* Resources */, 48A199DD1D8C564100C443D3 /* Embed Frameworks */, - BE7E038D141D4280EA132CFE /* [CP] Embed Pods Frameworks */, - 064902EF2BE3C866A1E65AD5 /* [CP] Copy Pods Resources */, + E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */, + 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -235,7 +235,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 064902EF2BE3C866A1E65AD5 /* [CP] Copy Pods Resources */ = { + 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -250,34 +250,34 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 117790000FDCD2E9548AA948 /* [CP] Check Pods Manifest.lock */ = { + E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - BE7E038D141D4280EA132CFE /* [CP] Embed Pods Frameworks */ = { + FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -410,7 +410,7 @@ }; 48A199C01D8C53AC00C443D3 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5C6F647894F9C3F73E521F72 /* Pods-Sample.debug.xcconfig */; + baseConfigurationReference = 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -427,7 +427,7 @@ }; 48A199C11D8C53AC00C443D3 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 78F7443CF377AB4C73185204 /* Pods-Sample.release.xcconfig */; + baseConfigurationReference = FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; diff --git a/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata b/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3..0000000 --- a/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - From 54c0fdcf726d71946d9c7620eca1a543df68b351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 22 Jan 2017 18:06:33 +0100 Subject: [PATCH 23/36] Show errors during directory content loading --- FileBrowser/FileListViewController.swift | 13 +++- examples/Sample/Sample/CustomDataSource.swift | 62 +++++++++++++------ 2 files changed, 52 insertions(+), 23 deletions(-) diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index 826041b..1b6d2ac 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -77,8 +77,7 @@ class FileListViewController: UIViewController { self.indexFiles() self.tableView.reloadData() case .error(let error): - // TODO: display errors - print(error.localizedDescription) + self.replaceTableViewRowsShowing(error: error) } } @@ -134,6 +133,14 @@ class FileListViewController: UIViewController { tableView.reloadData() } - + func replaceTableViewRowsShowing(error: Error) { + let errorLabel = UILabel(frame: CGRect(x: 0, y: 0, width: tableView.bounds.size.width, height: tableView.bounds.size.height)) + errorLabel.text = error.localizedDescription + errorLabel.textColor = UIColor.black + errorLabel.textAlignment = .center + + tableView.backgroundView = errorLabel + tableView.separatorStyle = .none + } } diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index c4da7ec..24c74a5 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -37,30 +37,39 @@ open class CustomDataSource: FileBrowserDataSource { open func provideContents(ofDirectory directory: FBFile, callback: @escaping (Result<[FBFile]>) -> ()) { // traverse the file tree outlined in the JSON file to find the directory let pathComponents = Array(directory.path.pathComponents.dropFirst()) // we're already in the root directory at the root of our json document - let directoryDescription = pathComponents.reduce(json) { currentFolder, subfolderName -> KeyValue in - let content = currentFolder["content"]! as! KeyValue - return content[subfolderName] as! KeyValue - } - - let files = (directoryDescription["content"] as! KeyValue).map {name, properties -> FBFile in - let properties = properties as! KeyValue - let isDirectory = (properties["type"] as? String) == "directory" - let path = directory.path.appendingPathComponent(name, isDirectory: isDirectory) - let file = FBFile(path: path) - if let resourceURLString = properties["location"] as? String, let resourceURL = URL(string: resourceURLString) { - file.fileLocation = resourceURL + do { + let directoryDescription = try pathComponents.reduce(json) { currentFolder, subfolderName throws -> KeyValue in + guard let content = currentFolder["content"] as? KeyValue else { + throw JSONParsingError.noDirectoryContent + } + return content[subfolderName] as! KeyValue + } + + guard let content = directoryDescription["content"] as? KeyValue else { + throw JSONParsingError.noDirectoryContent } - if let typeName = properties["type"] as? String, let type = FBFileType(rawValue: typeName) { - file.type = type + let files = content.map {name, properties -> FBFile in + let properties = properties as! KeyValue + let isDirectory = (properties["type"] as? String) == "directory" + let path = directory.path.appendingPathComponent(name, isDirectory: isDirectory) + let file = FBFile(path: path) + if let resourceURLString = properties["location"] as? String, let resourceURL = URL(string: resourceURLString) { + file.fileLocation = resourceURL + } + if let typeName = properties["type"] as? String, let type = FBFileType(rawValue: typeName) { + file.type = type + } + return file } - return file + + // simulate loading of remote content + DispatchQueue.main.asyncAfter(deadline: .now() + 0.4, execute: { + callback(.success(files)) + }) + } catch let error { + callback(.error(error)) } - // simulate loading of remote content - DispatchQueue.main.asyncAfter(deadline: .now() + 0.4, execute: { - callback(.success(files)) - }) - return } @@ -74,3 +83,16 @@ open class CustomDataSource: FileBrowserDataSource { } } + +enum JSONParsingError: Error { + case noDirectoryContent +} + +extension JSONParsingError: LocalizedError { + public var errorDescription: String? { + switch self { + case .noDirectoryContent: + return "Cannot read the directory contents" + } + } +} From c2c0c267ca1f4014d8a06b532fe772062e687acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 22 Jan 2017 18:19:03 +0100 Subject: [PATCH 24/36] Adapt and fix tests --- FileBrowser.xcodeproj/project.pbxproj | 10 ++++++- FileBrowser/FBFile.swift | 1 + FileBrowserTests/FileBrowserTests.swift | 37 ++++++++++++++----------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index f216739..0f06e7c 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -34,10 +34,14 @@ 349A12371C707E86005435C0 /* pdf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* pdf@2x.png */; }; 349A12381C707E86005435C0 /* zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* zip@2x.png */; }; C3308C8F1E3501BE00F4D125 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3308C8E1E3501BE00F4D125 /* Result.swift */; }; + C3308C901E351F9D00F4D125 /* FileParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3439AB671C6F203A0058AF04 /* FileParser.swift */; }; + C3308C911E351FB500F4D125 /* FBFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349A12271C707B1A005435C0 /* FBFile.swift */; }; + C3308C921E351FCF00F4D125 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3308C8E1E3501BE00F4D125 /* Result.swift */; }; + C3308C931E351FE900F4D125 /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; }; - C3D983CD1E195B9600A8CC06 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D983CC1E195B9600A8CC06 /* Result.swift */; }; + C3D983CD1E195B9600A8CC06 /* (null) in Sources */ = {isa = PBXBuildFile; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -354,6 +358,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + C3308C901E351F9D00F4D125 /* FileParser.swift in Sources */, + C3308C911E351FB500F4D125 /* FBFile.swift in Sources */, + C3308C921E351FCF00F4D125 /* Result.swift in Sources */, + C3308C931E351FE900F4D125 /* FileBrowserDataSource.swift in Sources */, 344169641C67812400B93D28 /* FileBrowserTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/FileBrowser/FBFile.swift b/FileBrowser/FBFile.swift index 86136e3..f375e60 100644 --- a/FileBrowser/FBFile.swift +++ b/FileBrowser/FBFile.swift @@ -7,6 +7,7 @@ // import Foundation +import UIKit /// FBFile is a class representing a file in FileBrowser open class FBFile: NSObject { diff --git a/FileBrowserTests/FileBrowserTests.swift b/FileBrowserTests/FileBrowserTests.swift index 57d1fe6..00565ad 100644 --- a/FileBrowserTests/FileBrowserTests.swift +++ b/FileBrowserTests/FileBrowserTests.swift @@ -49,16 +49,19 @@ class FileBrowserTests: XCTestCase { let parser = LocalFileParser() let directoryPath = Bundle(for: FileBrowserTests.self).bundleURL let directory = FBFile(path: directoryPath) - do { - let directoryContents = try parser.contents(ofDirectory: directory) - XCTAssertTrue(directoryContents.count > 0) - let stitchFile = directoryContents.filter({$0.displayName == "Stitch.jpg"}).first - XCTAssertNotNil(stitchFile) - if let stitchFile = stitchFile { - XCTAssertEqual(stitchFile.type, FBFileType.JPG) + + parser.provideContents(ofDirectory: directory) { result in + switch result { + case .error(let error): + XCTFail(error.localizedDescription) + case .success(let directoryContents): + XCTAssertTrue(directoryContents.count > 0) + let stitchFile = directoryContents.filter({$0.displayName == "Stitch.jpg"}).first + XCTAssertNotNil(stitchFile) + if let stitchFile = stitchFile { + XCTAssertEqual(stitchFile.type, FBFileType.JPG) + } } - } catch let error { - XCTFail(error.localizedDescription) } } @@ -67,15 +70,17 @@ class FileBrowserTests: XCTestCase { parser.excludesFileExtensions = ["gIf"] let directoryPath = Bundle(for: FileBrowserTests.self).bundleURL let directory = FBFile(path: directoryPath) - do { - let directoryContents = try parser.contents(ofDirectory: directory) - for file in directoryContents { - if let fileExtension = file.fileExtension { - XCTAssertFalse(fileExtension == "gif") + parser.provideContents(ofDirectory: directory) { result in + switch result { + case .error(let error): + XCTFail(error.localizedDescription) + case .success(let directoryContents): + for file in directoryContents { + if let fileExtension = file.fileExtension { + XCTAssertFalse(fileExtension == "gif") + } } } - } catch let error { - XCTFail(error.localizedDescription) } } From c59658385ea5057adce32a6e3dbe8a80fed6912f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 22 Jan 2017 18:19:42 +0100 Subject: [PATCH 25/36] Provide an example for a folder that fails to load --- examples/Sample/Sample/folderContent.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/Sample/Sample/folderContent.json b/examples/Sample/Sample/folderContent.json index 4d1c45c..e5490be 100644 --- a/examples/Sample/Sample/folderContent.json +++ b/examples/Sample/Sample/folderContent.json @@ -33,6 +33,10 @@ "location": "https://jsonplaceholder.typicode.com/users" } } + }, + "Invalid directory": { + "type": "directory", + "notContent": {} } } } From 7d783bd1d88d2696a2916963d7ec712e91ee6edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 22 Jan 2017 18:20:05 +0100 Subject: [PATCH 26/36] Add a loading indicator for folders --- FileBrowser/FileListViewController.swift | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index 1b6d2ac..66cefac 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -71,6 +71,7 @@ class FileListViewController: UIViewController { // Prepare data dataSource.provideContents(ofDirectory: self.directory) { result in + self.didCompleteLoading() switch result { case .success(let files): self.files = files @@ -81,6 +82,11 @@ class FileListViewController: UIViewController { } } + // show a loading indicator if it takes more than 0.5 seconds + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in + self?.showLoadingIndicatorIfNeeded() + } + // Set search bar tableView.tableHeaderView = searchController.searchBar @@ -142,5 +148,33 @@ class FileListViewController: UIViewController { tableView.backgroundView = errorLabel tableView.separatorStyle = .none } + + //MARK: loading indicator + + var loadingCompleted = false + func didCompleteLoading() { + locking(loadingCompleted) { + loadingCompleted = true + } + hideLoadingIndicator() + } + + func showLoadingIndicatorIfNeeded() { + locking(loadingCompleted) { + if !loadingCompleted { + navigationItem.prompt = "Loading..." + } + } + } + + func hideLoadingIndicator() { + navigationItem.prompt = nil + } + + func locking(_ lock: Any, closure: () -> ()) { + objc_sync_enter(lock) + closure() + objc_sync_exit(lock) + } } From 186ec607db67d494dceec936650d459d9f5d4ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Sun, 22 Jan 2017 18:46:50 +0100 Subject: [PATCH 27/36] Show downloading errors, remove unnecessary URLSession functions --- FileBrowser/LoadingViewController.swift | 38 +++++++++++++------ .../Resources/LoadingViewController.xib | 16 +++++++- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/FileBrowser/LoadingViewController.swift b/FileBrowser/LoadingViewController.swift index bbdcad9..f2ca753 100644 --- a/FileBrowser/LoadingViewController.swift +++ b/FileBrowser/LoadingViewController.swift @@ -14,6 +14,8 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe //MARK: Lifecycle @IBOutlet var progressView: UIProgressView! + @IBOutlet var errorLabel: UILabel! + @IBOutlet var cancelButton: UIButton! var downloadTask: URLSessionDownloadTask? var session: URLSession! @@ -32,21 +34,24 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe override func viewDidLoad() { super.viewDidLoad() - print("Test loading") progressView.setProgress(0, animated: false) guard let fileLocation = file.fileLocation else { print("Error: File has no fileLocation set") return } - downloadTask = session.downloadTask(with: fileLocation) downloadTask!.resume() } + override func viewWillDisappear(_ animated: Bool) { + downloadTask?.cancel() + } + @IBAction func cancelButtonTapped(_ sender: Any) { downloadTask?.cancel() + navigationController?.popViewController(animated: true) } func showFile(data: Data?) { @@ -62,7 +67,7 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe nav.setViewControllers(viewControllers, animated: true) } else { - self.present(controller, animated: true, completion: nil) + self.present(controller, animated: true, completion: nil) } if let ql = (controller as? QLPreviewController) ?? (controller as? PreviewTransitionViewController)?.quickLookPreviewController { // fix for dataSource magically disappearing because hey let's store it in a weak variable in QLPreviewController @@ -71,22 +76,31 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe } } } - - func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) { - completionHandler(.allow) - } - func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { - completionHandler(.performDefaultHandling, nil) + + func show(error: Error) { + DispatchQueue.main.async { + self.cancelButton.isHidden = true + self.progressView.isHidden = true + self.errorLabel.text = error.localizedDescription + self.errorLabel.isHidden = false + } } + + //MARK: URLSession + func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { - print(error?.localizedDescription) + if let error = error { + show(error: error) + } } + func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) { do { let data = try Data(contentsOf: location) self.showFile(data: data) } catch let error { print(error) + show(error: error) } } @@ -98,8 +112,8 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe } func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { - if let error = error { - print(error.localizedDescription) + if let error = error, (error as? NSError)?.code != NSURLErrorCancelled { + show(error: error) } session.finishTasksAndInvalidate() } diff --git a/FileBrowser/Resources/LoadingViewController.xib b/FileBrowser/Resources/LoadingViewController.xib index 799d8f7..12cbb8f 100644 --- a/FileBrowser/Resources/LoadingViewController.xib +++ b/FileBrowser/Resources/LoadingViewController.xib @@ -11,6 +11,8 @@ + + @@ -30,19 +32,31 @@ + + + + - + From f8d6849942069c1dd4a3f9e3c9f82d988b6bc145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Mon, 23 Jan 2017 17:27:55 +0100 Subject: [PATCH 28/36] Fix WebView not displaying files --- FileBrowser/FBFile.swift | 2 ++ FileBrowser/WebviewPreviewViewContoller.swift | 2 ++ 2 files changed, 4 insertions(+) diff --git a/FileBrowser/FBFile.swift b/FileBrowser/FBFile.swift index f375e60..a83c2cc 100644 --- a/FileBrowser/FBFile.swift +++ b/FileBrowser/FBFile.swift @@ -25,6 +25,7 @@ open class FBFile: NSObject { // FBFileType open var type: FBFileType + /// Describes the path in the current file system, e.g. /dir/file.txt open let path: URL /** @@ -36,6 +37,7 @@ open class FBFile: NSObject { */ public init(path: URL) { self.path = path + self.fileLocation = path self.isDirectory = checkDirectory(path) if self.isDirectory { diff --git a/FileBrowser/WebviewPreviewViewContoller.swift b/FileBrowser/WebviewPreviewViewContoller.swift index 0fdd55d..b4310bd 100644 --- a/FileBrowser/WebviewPreviewViewContoller.swift +++ b/FileBrowser/WebviewPreviewViewContoller.swift @@ -64,6 +64,7 @@ class WebviewPreviewViewContoller: UIViewController { func processForDisplay() { guard let file = file else { + print("file is not set!") return } @@ -75,6 +76,7 @@ class WebviewPreviewViewContoller: UIViewController { let fileData = try? Data(contentsOf: localFileUrl) { data = fileData } else { + print("Could not find data for file!") return } From 0fb0517e133a72e572c6d5b73757240e7e31e319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Mon, 23 Jan 2017 18:01:23 +0100 Subject: [PATCH 29/36] Remove option to exclude files with empty filenames I don't think that this is a relevant option --- FileBrowser/FileBrowser.swift | 7 ------- FileBrowser/FileBrowserDataSource.swift | 1 - FileBrowser/FileParser.swift | 3 --- examples/Sample/Sample/CustomDataSource.swift | 1 - 4 files changed, 12 deletions(-) diff --git a/FileBrowser/FileBrowser.swift b/FileBrowser/FileBrowser.swift index 551e9c6..b00d888 100644 --- a/FileBrowser/FileBrowser.swift +++ b/FileBrowser/FileBrowser.swift @@ -29,13 +29,6 @@ open class FileBrowser: UINavigationController { } } - /// Whether to exclude files with empty filenames - open var excludesWithEmptyFilenames: Bool = false { - didSet { - dataSource.excludesWithEmptyFilenames = excludesWithEmptyFilenames - } - } - /// Override default preview and actionsheet behaviour in favour of custom file handling. open var didSelectFile: ((FBFile) -> ())? { didSet { diff --git a/FileBrowser/FileBrowserDataSource.swift b/FileBrowser/FileBrowserDataSource.swift index c6abdcf..2d48f68 100644 --- a/FileBrowser/FileBrowserDataSource.swift +++ b/FileBrowser/FileBrowserDataSource.swift @@ -18,7 +18,6 @@ public protocol FileBrowserDataSource { var excludesFileExtensions: [String]? { get set } var excludesFilepaths: [URL]? { get set } - var excludesWithEmptyFilenames: Bool { get set } } extension FileBrowserDataSource { diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index ce125e3..55930c6 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -43,9 +43,6 @@ class LocalFileParser: FileBrowserDataSource { if let excludesFilepaths = excludesFilepaths { files = files.filter { !excludesFilepaths.contains($0.path) } } - if excludesWithEmptyFilenames { - files = files.filter { !$0.displayName.isEmpty } - } // Sort files = files.sorted(){$0.displayName < $1.displayName} diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index 24c74a5..c32b86c 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -22,7 +22,6 @@ open class CustomDataSource: FileBrowserDataSource { public var excludesFileExtensions: [String]? = nil public var excludesFilepaths: [URL]? = nil - public var excludesWithEmptyFilenames = false let rootUrl = URL(string: "/")! public var rootDirectory: FBFile { From 4f9bcdfdac7f45637ec129875a129371f6830be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Mon, 8 May 2017 11:11:13 +0200 Subject: [PATCH 30/36] Fix build settings --- examples/Sample/Podfile | 2 +- examples/Sample/Podfile.lock | 6 +- .../Sample/Sample.xcodeproj/project.pbxproj | 1502 ++++++++++++----- .../contents.xcworkspacedata | 10 + 4 files changed, 1048 insertions(+), 472 deletions(-) create mode 100644 examples/Sample/Sample.xcworkspace/contents.xcworkspacedata diff --git a/examples/Sample/Podfile b/examples/Sample/Podfile index 1fa33b7..4324b8d 100644 --- a/examples/Sample/Podfile +++ b/examples/Sample/Podfile @@ -3,7 +3,7 @@ platform :ios, "8.0" use_frameworks! project 'Sample' -workspace '../../FileBrowserWorkspace' +# workspace '../../FileBrowserWorkspace' target 'Sample' do pod 'FileBrowser', :path => '../../FileBrowser.podspec' diff --git a/examples/Sample/Podfile.lock b/examples/Sample/Podfile.lock index 161f932..e06f641 100644 --- a/examples/Sample/Podfile.lock +++ b/examples/Sample/Podfile.lock @@ -6,11 +6,11 @@ DEPENDENCIES: EXTERNAL SOURCES: FileBrowser: - :path: "../../FileBrowser.podspec" + :path: ../../FileBrowser.podspec SPEC CHECKSUMS: FileBrowser: af8abc035daca66a6066351ae162c4af4c6b24dd -PODFILE CHECKSUM: ca61a48c4a562caf636cf07a5f677bfee5b56184 +PODFILE CHECKSUM: 89b602114a6137a17b342c624bbed635b89d7a0e -COCOAPODS: 1.1.1 +COCOAPODS: 1.0.1 diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 818131f..6a7a41b 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -1,468 +1,1034 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 48A199B61D8C53AC00C443D3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48A199B41D8C53AC00C443D3 /* Main.storyboard */; }; - 48A199B81D8C53AC00C443D3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 48A199B71D8C53AC00C443D3 /* Assets.xcassets */; }; - 48A199BB1D8C53AC00C443D3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48A199B91D8C53AC00C443D3 /* LaunchScreen.storyboard */; }; - 48A199C51D8C53DB00C443D3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A199C31D8C53DB00C443D3 /* AppDelegate.swift */; }; - 48A199C81D8C53E200C443D3 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A199C71D8C53E200C443D3 /* MainViewController.swift */; }; - 48A199CD1D8C546000C443D3 /* Baymax.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199C91D8C546000C443D3 /* Baymax.jpg */; }; - 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CA1D8C546000C443D3 /* BB8.jpg */; }; - 48A199CF1D8C546000C443D3 /* Images.zip in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CB1D8C546000C443D3 /* Images.zip */; }; - 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CC1D8C546000C443D3 /* Stitch.jpg */; }; - 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */; }; - C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3368F3C1E167B91003F4664 /* FileBrowser.framework */; }; - C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */; }; - C3BF0E061E1563F10009D12C /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E051E1563F10009D12C /* Podfile */; }; - C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E0F1E1591DC0009D12C /* folderContent.json */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 48A199DD1D8C564100C443D3 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; - 48A199AD1D8C53AC00C443D3 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 48A199B51D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 48A199B71D8C53AC00C443D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 48A199BA1D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 48A199C31D8C53DB00C443D3 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = "Supporting Files/AppDelegate.swift"; sourceTree = ""; }; - 48A199C41D8C53DB00C443D3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Supporting Files/Info.plist"; sourceTree = ""; }; - 48A199C71D8C53E200C443D3 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MainViewController.swift; path = "View Controller/MainViewController.swift"; sourceTree = ""; }; - 48A199C91D8C546000C443D3 /* Baymax.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Baymax.jpg; sourceTree = ""; }; - 48A199CA1D8C546000C443D3 /* BB8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = BB8.jpg; sourceTree = ""; }; - 48A199CB1D8C546000C443D3 /* Images.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Images.zip; sourceTree = ""; }; - 48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; - 48A24C321D8C59250044C697 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; - C3368F3C1E167B91003F4664 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; - C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDataSource.swift; sourceTree = ""; }; - C3BF0E051E1563F10009D12C /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - C3BF0E071E156BE60009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; - C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; - C3BF0E0F1E1591DC0009D12C /* folderContent.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = folderContent.json; sourceTree = ""; }; - D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 48A199AA1D8C53AC00C443D3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */, - 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 48A199A41D8C53AC00C443D3 = { - isa = PBXGroup; - children = ( - 48A199AF1D8C53AC00C443D3 /* Sample */, - 48A199AE1D8C53AC00C443D3 /* Products */, - 48A24C2F1D8C57390044C697 /* Frameworks */, - C3BF0E051E1563F10009D12C /* Podfile */, - 7941567C86F4C287F933E7D4 /* Pods */, - ); - sourceTree = ""; - }; - 48A199AE1D8C53AC00C443D3 /* Products */ = { - isa = PBXGroup; - children = ( - 48A199AD1D8C53AC00C443D3 /* Sample.app */, - ); - name = Products; - sourceTree = ""; - }; - 48A199AF1D8C53AC00C443D3 /* Sample */ = { - isa = PBXGroup; - children = ( - 48A199D21D8C546F00C443D3 /* View Controller */, - 48A199C21D8C53B700C443D3 /* Supporting Files */, - ); - path = Sample; - sourceTree = ""; - }; - 48A199C21D8C53B700C443D3 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 48A199D11D8C546500C443D3 /* Resources */, - 48A199C31D8C53DB00C443D3 /* AppDelegate.swift */, - C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */, - 48A199C41D8C53DB00C443D3 /* Info.plist */, - 48A199B41D8C53AC00C443D3 /* Main.storyboard */, - 48A199B71D8C53AC00C443D3 /* Assets.xcassets */, - 48A199B91D8C53AC00C443D3 /* LaunchScreen.storyboard */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 48A199D11D8C546500C443D3 /* Resources */ = { - isa = PBXGroup; - children = ( - 48A199C91D8C546000C443D3 /* Baymax.jpg */, - 48A199CA1D8C546000C443D3 /* BB8.jpg */, - 48A199CB1D8C546000C443D3 /* Images.zip */, - 48A199CC1D8C546000C443D3 /* Stitch.jpg */, - C3BF0E0F1E1591DC0009D12C /* folderContent.json */, - ); - name = Resources; - sourceTree = ""; - }; - 48A199D21D8C546F00C443D3 /* View Controller */ = { - isa = PBXGroup; - children = ( - 48A199C71D8C53E200C443D3 /* MainViewController.swift */, - ); - name = "View Controller"; - sourceTree = ""; - }; - 48A24C2F1D8C57390044C697 /* Frameworks */ = { - isa = PBXGroup; - children = ( - C3368F3C1E167B91003F4664 /* FileBrowser.framework */, - C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */, - C3BF0E071E156BE60009D12C /* FileBrowser.framework */, - 48A24C321D8C59250044C697 /* FileBrowser.framework */, - D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 7941567C86F4C287F933E7D4 /* Pods */ = { - isa = PBXGroup; - children = ( - 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */, - FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 48A199AC1D8C53AC00C443D3 /* Sample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */; - buildPhases = ( - FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */, - 48A199A91D8C53AC00C443D3 /* Sources */, - 48A199AA1D8C53AC00C443D3 /* Frameworks */, - 48A199AB1D8C53AC00C443D3 /* Resources */, - 48A199DD1D8C564100C443D3 /* Embed Frameworks */, - E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */, - 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Sample; - productName = Sample; - productReference = 48A199AD1D8C53AC00C443D3 /* Sample.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 48A199A51D8C53AC00C443D3 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0810; - ORGANIZATIONNAME = "Mihail Șalari"; - TargetAttributes = { - 48A199AC1D8C53AC00C443D3 = { - CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0800; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 48A199A81D8C53AC00C443D3 /* Build configuration list for PBXProject "Sample" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 48A199A41D8C53AC00C443D3; - productRefGroup = 48A199AE1D8C53AC00C443D3 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 48A199AC1D8C53AC00C443D3 /* Sample */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 48A199AB1D8C53AC00C443D3 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 48A199BB1D8C53AC00C443D3 /* LaunchScreen.storyboard in Resources */, - 48A199CF1D8C546000C443D3 /* Images.zip in Resources */, - C3BF0E061E1563F10009D12C /* Podfile in Resources */, - 48A199B81D8C53AC00C443D3 /* Assets.xcassets in Resources */, - 48A199B61D8C53AC00C443D3 /* Main.storyboard in Resources */, - 48A199CD1D8C546000C443D3 /* Baymax.jpg in Resources */, - 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */, - 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */, - C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 48A199A91D8C53AC00C443D3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 48A199C81D8C53E200C443D3 /* MainViewController.swift in Sources */, - 48A199C51D8C53DB00C443D3 /* AppDelegate.swift in Sources */, - C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 48A199B41D8C53AC00C443D3 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 48A199B51D8C53AC00C443D3 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 48A199B91D8C53AC00C443D3 /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 48A199BA1D8C53AC00C443D3 /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 48A199BD1D8C53AC00C443D3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 48A199BE1D8C53AC00C443D3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 48A199C01D8C53AC00C443D3 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mihailsalari.Sample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 48A199C11D8C53AC00C443D3 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mihailsalari.Sample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 48A199A81D8C53AC00C443D3 /* Build configuration list for PBXProject "Sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 48A199BD1D8C53AC00C443D3 /* Debug */, - 48A199BE1D8C53AC00C443D3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 48A199C01D8C53AC00C443D3 /* Debug */, - 48A199C11D8C53AC00C443D3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 48A199A51D8C53AC00C443D3 /* Project object */; -} + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 28E13CD638951BF207ADFF8D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods-Sample.debug.xcconfig + path + Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig + sourceTree + <group> + + 46314AB0569B89DDC16A2375 + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + [CP] Copy Pods Resources + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + "${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh" + + showEnvVarsInLog + 0 + + 48A199A41D8C53AC00C443D3 + + children + + 48A199AF1D8C53AC00C443D3 + 48A199AE1D8C53AC00C443D3 + 48A24C2F1D8C57390044C697 + C3BF0E051E1563F10009D12C + 7941567C86F4C287F933E7D4 + + isa + PBXGroup + sourceTree + <group> + + 48A199A51D8C53AC00C443D3 + + attributes + + LastSwiftUpdateCheck + 0800 + LastUpgradeCheck + 0810 + ORGANIZATIONNAME + Mihail Șalari + TargetAttributes + + 48A199AC1D8C53AC00C443D3 + + CreatedOnToolsVersion + 8.0 + LastSwiftMigration + 0800 + ProvisioningStyle + Automatic + + + + buildConfigurationList + 48A199A81D8C53AC00C443D3 + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + Base + + mainGroup + 48A199A41D8C53AC00C443D3 + productRefGroup + 48A199AE1D8C53AC00C443D3 + projectDirPath + + projectReferences + + projectRoot + + targets + + 48A199AC1D8C53AC00C443D3 + + + 48A199A81D8C53AC00C443D3 + + buildConfigurations + + 48A199BD1D8C53AC00C443D3 + 48A199BE1D8C53AC00C443D3 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 48A199A91D8C53AC00C443D3 + + buildActionMask + 2147483647 + files + + 48A199C81D8C53E200C443D3 + 48A199C51D8C53DB00C443D3 + C3BF0DFE1E13F5340009D12C + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 48A199AA1D8C53AC00C443D3 + + buildActionMask + 2147483647 + files + + C3368F3D1E167B91003F4664 + 760CE3C0DC5DA79C68460A63 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 48A199AB1D8C53AC00C443D3 + + buildActionMask + 2147483647 + files + + 48A199BB1D8C53AC00C443D3 + 48A199CF1D8C546000C443D3 + C3BF0E061E1563F10009D12C + 48A199B81D8C53AC00C443D3 + 48A199B61D8C53AC00C443D3 + 48A199CD1D8C546000C443D3 + 48A199D01D8C546000C443D3 + 48A199CE1D8C546000C443D3 + C3BF0E101E1591DC0009D12C + + isa + PBXResourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 48A199AC1D8C53AC00C443D3 + + buildConfigurationList + 48A199BF1D8C53AC00C443D3 + buildPhases + + FE1FF64C54996947165EA6D1 + 48A199A91D8C53AC00C443D3 + 48A199AA1D8C53AC00C443D3 + 48A199AB1D8C53AC00C443D3 + 48A199DD1D8C564100C443D3 + E5DD55652D3BD1C4AF23C734 + 46314AB0569B89DDC16A2375 + + buildRules + + dependencies + + isa + PBXNativeTarget + name + Sample + productName + Sample + productReference + 48A199AD1D8C53AC00C443D3 + productType + com.apple.product-type.application + + 48A199AD1D8C53AC00C443D3 + + explicitFileType + wrapper.application + includeInIndex + 0 + isa + PBXFileReference + path + Sample.app + sourceTree + BUILT_PRODUCTS_DIR + + 48A199AE1D8C53AC00C443D3 + + children + + 48A199AD1D8C53AC00C443D3 + + isa + PBXGroup + name + Products + sourceTree + <group> + + 48A199AF1D8C53AC00C443D3 + + children + + 48A199D21D8C546F00C443D3 + 48A199C21D8C53B700C443D3 + + isa + PBXGroup + path + Sample + sourceTree + <group> + + 48A199B41D8C53AC00C443D3 + + children + + 48A199B51D8C53AC00C443D3 + + isa + PBXVariantGroup + name + Main.storyboard + sourceTree + <group> + + 48A199B51D8C53AC00C443D3 + + isa + PBXFileReference + lastKnownFileType + file.storyboard + name + Base + path + Base.lproj/Main.storyboard + sourceTree + <group> + + 48A199B61D8C53AC00C443D3 + + fileRef + 48A199B41D8C53AC00C443D3 + isa + PBXBuildFile + + 48A199B71D8C53AC00C443D3 + + isa + PBXFileReference + lastKnownFileType + folder.assetcatalog + path + Assets.xcassets + sourceTree + <group> + + 48A199B81D8C53AC00C443D3 + + fileRef + 48A199B71D8C53AC00C443D3 + isa + PBXBuildFile + + 48A199B91D8C53AC00C443D3 + + children + + 48A199BA1D8C53AC00C443D3 + + isa + PBXVariantGroup + name + LaunchScreen.storyboard + sourceTree + <group> + + 48A199BA1D8C53AC00C443D3 + + isa + PBXFileReference + lastKnownFileType + file.storyboard + name + Base + path + Base.lproj/LaunchScreen.storyboard + sourceTree + <group> + + 48A199BB1D8C53AC00C443D3 + + fileRef + 48A199B91D8C53AC00C443D3 + isa + PBXBuildFile + + 48A199BD1D8C53AC00C443D3 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_ANALYZER_NONNULL + YES + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES_ERROR + CLANG_WARN_DOCUMENTATION_COMMENTS + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INFINITE_RECURSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES_ERROR + CLANG_WARN_SUSPICIOUS_MOVE + YES + CLANG_WARN_SUSPICIOUS_MOVES + YES + CLANG_WARN_UNREACHABLE_CODE + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + COPY_PHASE_STRIP + NO + DEBUG_INFORMATION_FORMAT + dwarf + ENABLE_STRICT_OBJC_MSGSEND + YES + ENABLE_TESTABILITY + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_NO_COMMON_BLOCKS + YES + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES_ERROR + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES_AGGRESSIVE + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 10.0 + MTL_ENABLE_DEBUG_INFO + YES + ONLY_ACTIVE_ARCH + YES + SDKROOT + iphoneos + SWIFT_ACTIVE_COMPILATION_CONDITIONS + DEBUG + SWIFT_OPTIMIZATION_LEVEL + -Onone + TARGETED_DEVICE_FAMILY + 1,2 + + isa + XCBuildConfiguration + name + Debug + + 48A199BE1D8C53AC00C443D3 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_ANALYZER_NONNULL + YES + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES_ERROR + CLANG_WARN_DOCUMENTATION_COMMENTS + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INFINITE_RECURSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES_ERROR + CLANG_WARN_SUSPICIOUS_MOVE + YES + CLANG_WARN_SUSPICIOUS_MOVES + YES + CLANG_WARN_UNREACHABLE_CODE + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + COPY_PHASE_STRIP + NO + DEBUG_INFORMATION_FORMAT + dwarf-with-dsym + ENABLE_NS_ASSERTIONS + NO + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_NO_COMMON_BLOCKS + YES + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES_ERROR + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES_AGGRESSIVE + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 10.0 + MTL_ENABLE_DEBUG_INFO + NO + SDKROOT + iphoneos + SWIFT_OPTIMIZATION_LEVEL + -Owholemodule + TARGETED_DEVICE_FAMILY + 1,2 + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 48A199BF1D8C53AC00C443D3 + + buildConfigurations + + 48A199C01D8C53AC00C443D3 + 48A199C11D8C53AC00C443D3 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 48A199C01D8C53AC00C443D3 + + baseConfigurationReference + 28E13CD638951BF207ADFF8D + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + ASSETCATALOG_COMPILER_APPICON_NAME + AppIcon + CLANG_ENABLE_MODULES + YES + DEVELOPMENT_TEAM + + INFOPLIST_FILE + $(SRCROOT)/Sample/Supporting Files/Info.plist + LD_RUNPATH_SEARCH_PATHS + $(inherited) @executable_path/Frameworks + PRODUCT_BUNDLE_IDENTIFIER + com.mihailsalari.Sample + PRODUCT_NAME + $(TARGET_NAME) + SWIFT_OPTIMIZATION_LEVEL + -Onone + SWIFT_VERSION + 3.0 + + isa + XCBuildConfiguration + name + Debug + + 48A199C11D8C53AC00C443D3 + + baseConfigurationReference + FFE0589B53B1161442905147 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + ASSETCATALOG_COMPILER_APPICON_NAME + AppIcon + CLANG_ENABLE_MODULES + YES + DEVELOPMENT_TEAM + + INFOPLIST_FILE + $(SRCROOT)/Sample/Supporting Files/Info.plist + LD_RUNPATH_SEARCH_PATHS + $(inherited) @executable_path/Frameworks + PRODUCT_BUNDLE_IDENTIFIER + com.mihailsalari.Sample + PRODUCT_NAME + $(TARGET_NAME) + SWIFT_VERSION + 3.0 + + isa + XCBuildConfiguration + name + Release + + 48A199C21D8C53B700C443D3 + + children + + 48A199D11D8C546500C443D3 + 48A199C31D8C53DB00C443D3 + C3BF0DFD1E13F5340009D12C + 48A199C41D8C53DB00C443D3 + 48A199B41D8C53AC00C443D3 + 48A199B71D8C53AC00C443D3 + 48A199B91D8C53AC00C443D3 + + isa + PBXGroup + name + Supporting Files + sourceTree + <group> + + 48A199C31D8C53DB00C443D3 + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + AppDelegate.swift + path + Supporting Files/AppDelegate.swift + sourceTree + <group> + + 48A199C41D8C53DB00C443D3 + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + name + Info.plist + path + Supporting Files/Info.plist + sourceTree + <group> + + 48A199C51D8C53DB00C443D3 + + fileRef + 48A199C31D8C53DB00C443D3 + isa + PBXBuildFile + + 48A199C71D8C53E200C443D3 + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + name + MainViewController.swift + path + View Controller/MainViewController.swift + sourceTree + <group> + + 48A199C81D8C53E200C443D3 + + fileRef + 48A199C71D8C53E200C443D3 + isa + PBXBuildFile + + 48A199C91D8C546000C443D3 + + isa + PBXFileReference + lastKnownFileType + image.jpeg + path + Baymax.jpg + sourceTree + <group> + + 48A199CA1D8C546000C443D3 + + isa + PBXFileReference + lastKnownFileType + image.jpeg + path + BB8.jpg + sourceTree + <group> + + 48A199CB1D8C546000C443D3 + + isa + PBXFileReference + lastKnownFileType + archive.zip + path + Images.zip + sourceTree + <group> + + 48A199CC1D8C546000C443D3 + + isa + PBXFileReference + lastKnownFileType + image.jpeg + path + Stitch.jpg + sourceTree + <group> + + 48A199CD1D8C546000C443D3 + + fileRef + 48A199C91D8C546000C443D3 + isa + PBXBuildFile + + 48A199CE1D8C546000C443D3 + + fileRef + 48A199CA1D8C546000C443D3 + isa + PBXBuildFile + + 48A199CF1D8C546000C443D3 + + fileRef + 48A199CB1D8C546000C443D3 + isa + PBXBuildFile + + 48A199D01D8C546000C443D3 + + fileRef + 48A199CC1D8C546000C443D3 + isa + PBXBuildFile + + 48A199D11D8C546500C443D3 + + children + + 48A199C91D8C546000C443D3 + 48A199CA1D8C546000C443D3 + 48A199CB1D8C546000C443D3 + 48A199CC1D8C546000C443D3 + C3BF0E0F1E1591DC0009D12C + + isa + PBXGroup + name + Resources + sourceTree + <group> + + 48A199D21D8C546F00C443D3 + + children + + 48A199C71D8C53E200C443D3 + + isa + PBXGroup + name + View Controller + sourceTree + <group> + + 48A199DD1D8C564100C443D3 + + buildActionMask + 2147483647 + dstPath + + dstSubfolderSpec + 10 + files + + isa + PBXCopyFilesBuildPhase + name + Embed Frameworks + runOnlyForDeploymentPostprocessing + 0 + + 48A24C2F1D8C57390044C697 + + children + + C3368F3C1E167B91003F4664 + C3BF0E0B1E15723A0009D12C + C3BF0E071E156BE60009D12C + 48A24C321D8C59250044C697 + D2C28D7CA33CEE3E4A364447 + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + 48A24C321D8C59250044C697 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + FileBrowser.framework + path + ../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework + sourceTree + <group> + + 760CE3C0DC5DA79C68460A63 + + fileRef + D2C28D7CA33CEE3E4A364447 + isa + PBXBuildFile + + 7941567C86F4C287F933E7D4 + + children + + 28E13CD638951BF207ADFF8D + FFE0589B53B1161442905147 + + isa + PBXGroup + name + Pods + sourceTree + <group> + + C3368F3C1E167B91003F4664 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + FileBrowser.framework + path + ../../build/Debug-iphoneos/FileBrowser.framework + sourceTree + <group> + + C3368F3D1E167B91003F4664 + + fileRef + C3368F3C1E167B91003F4664 + isa + PBXBuildFile + + C3BF0DFD1E13F5340009D12C + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + sourcecode.swift + path + CustomDataSource.swift + sourceTree + <group> + + C3BF0DFE1E13F5340009D12C + + fileRef + C3BF0DFD1E13F5340009D12C + isa + PBXBuildFile + + C3BF0E051E1563F10009D12C + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + text + path + Podfile + sourceTree + <group> + xcLanguageSpecificationIdentifier + xcode.lang.ruby + + C3BF0E061E1563F10009D12C + + fileRef + C3BF0E051E1563F10009D12C + isa + PBXBuildFile + + C3BF0E071E156BE60009D12C + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + FileBrowser.framework + path + ../../build/Debug-iphoneos/FileBrowser.framework + sourceTree + <group> + + C3BF0E0B1E15723A0009D12C + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + FileBrowser.framework + path + ../../build/Debug-iphoneos/FileBrowser.framework + sourceTree + <group> + + C3BF0E0F1E1591DC0009D12C + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + text.json + path + folderContent.json + sourceTree + <group> + + C3BF0E101E1591DC0009D12C + + fileRef + C3BF0E0F1E1591DC0009D12C + isa + PBXBuildFile + + D2C28D7CA33CEE3E4A364447 + + explicitFileType + wrapper.framework + includeInIndex + 0 + isa + PBXFileReference + path + Pods_Sample.framework + sourceTree + BUILT_PRODUCTS_DIR + + E5DD55652D3BD1C4AF23C734 + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + [CP] Embed Pods Frameworks + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + "${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh" + + showEnvVarsInLog + 0 + + FE1FF64C54996947165EA6D1 + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + [CP] Check Pods Manifest.lock + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null +if [[ $? != 0 ]] ; then + cat << EOM +error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. +EOM + exit 1 +fi + + showEnvVarsInLog + 0 + + FFE0589B53B1161442905147 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods-Sample.release.xcconfig + path + Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig + sourceTree + <group> + + + rootObject + 48A199A51D8C53AC00C443D3 + + diff --git a/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata b/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..7b5a2f3 --- /dev/null +++ b/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + From 4aaaf83b0eddfec0825705791e21ab7d29a807a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Mon, 8 May 2017 11:20:44 +0200 Subject: [PATCH 31/36] Fix SWIFT_VERSION being unset in examples --- examples/Sample/Podfile | 8 ++++++++ examples/Sample/Podfile.lock | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/Sample/Podfile b/examples/Sample/Podfile index 4324b8d..2a96cc8 100644 --- a/examples/Sample/Podfile +++ b/examples/Sample/Podfile @@ -8,3 +8,11 @@ project 'Sample' target 'Sample' do pod 'FileBrowser', :path => '../../FileBrowser.podspec' end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['SWIFT_VERSION'] = '3.0' + end + end +end diff --git a/examples/Sample/Podfile.lock b/examples/Sample/Podfile.lock index e06f641..46d10dd 100644 --- a/examples/Sample/Podfile.lock +++ b/examples/Sample/Podfile.lock @@ -11,6 +11,6 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: FileBrowser: af8abc035daca66a6066351ae162c4af4c6b24dd -PODFILE CHECKSUM: 89b602114a6137a17b342c624bbed635b89d7a0e +PODFILE CHECKSUM: 25d6e7f3f21422400c1d0693c31a9c3655ff1c8b COCOAPODS: 1.0.1 From adee3ecc7bca0d8c4ca8ecaf524e086e68692d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Tue, 9 May 2017 09:57:20 +0200 Subject: [PATCH 32/36] Rename Result to FBResult to avoid namespace collisions --- FileBrowser.xcodeproj/project.pbxproj | 12 ++++++------ FileBrowser/{Result.swift => FBResult.swift} | 4 ++-- FileBrowser/FileBrowserDataSource.swift | 2 +- FileBrowser/FileParser.swift | 2 +- examples/Sample/Sample/CustomDataSource.swift | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename FileBrowser/{Result.swift => FBResult.swift} (80%) diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 0f06e7c..54ad981 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -33,10 +33,10 @@ 349A12361C707E86005435C0 /* image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A122F1C707E86005435C0 /* image@2x.png */; }; 349A12371C707E86005435C0 /* pdf@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* pdf@2x.png */; }; 349A12381C707E86005435C0 /* zip@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* zip@2x.png */; }; - C3308C8F1E3501BE00F4D125 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3308C8E1E3501BE00F4D125 /* Result.swift */; }; + C3308C8F1E3501BE00F4D125 /* FBResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3308C8E1E3501BE00F4D125 /* FBResult.swift */; }; C3308C901E351F9D00F4D125 /* FileParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3439AB671C6F203A0058AF04 /* FileParser.swift */; }; C3308C911E351FB500F4D125 /* FBFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349A12271C707B1A005435C0 /* FBFile.swift */; }; - C3308C921E351FCF00F4D125 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3308C8E1E3501BE00F4D125 /* Result.swift */; }; + C3308C921E351FCF00F4D125 /* FBResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3308C8E1E3501BE00F4D125 /* FBResult.swift */; }; C3308C931E351FE900F4D125 /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; @@ -84,7 +84,7 @@ 349A122F1C707E86005435C0 /* image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image@2x.png"; sourceTree = ""; }; 349A12301C707E86005435C0 /* pdf@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pdf@2x.png"; sourceTree = ""; }; 349A12311C707E86005435C0 /* zip@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zip@2x.png"; sourceTree = ""; }; - C3308C8E1E3501BE00F4D125 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; }; + C3308C8E1E3501BE00F4D125 /* FBResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FBResult.swift; sourceTree = ""; }; C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = ""; }; C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; @@ -117,7 +117,7 @@ 3439AB671C6F203A0058AF04 /* FileParser.swift */, 349A12271C707B1A005435C0 /* FBFile.swift */, C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */, - C3308C8E1E3501BE00F4D125 /* Result.swift */, + C3308C8E1E3501BE00F4D125 /* FBResult.swift */, ); name = Data; sourceTree = ""; @@ -341,7 +341,7 @@ C3D983CD1E195B9600A8CC06 /* (null) in Sources */, 3439AB701C6FF68C0058AF04 /* FileBrowser.swift in Sources */, 349A12261C707317005435C0 /* FileListTableView.swift in Sources */, - C3308C8F1E3501BE00F4D125 /* Result.swift in Sources */, + C3308C8F1E3501BE00F4D125 /* FBResult.swift in Sources */, 343C44661C73CD3200D874FB /* PreviewManager.swift in Sources */, 3439AB681C6F203A0058AF04 /* FileParser.swift in Sources */, 349A12281C707B1A005435C0 /* FBFile.swift in Sources */, @@ -360,7 +360,7 @@ files = ( C3308C901E351F9D00F4D125 /* FileParser.swift in Sources */, C3308C911E351FB500F4D125 /* FBFile.swift in Sources */, - C3308C921E351FCF00F4D125 /* Result.swift in Sources */, + C3308C921E351FCF00F4D125 /* FBResult.swift in Sources */, C3308C931E351FE900F4D125 /* FileBrowserDataSource.swift in Sources */, 344169641C67812400B93D28 /* FileBrowserTests.swift in Sources */, ); diff --git a/FileBrowser/Result.swift b/FileBrowser/FBResult.swift similarity index 80% rename from FileBrowser/Result.swift rename to FileBrowser/FBResult.swift index d3c9bf1..c613d4f 100644 --- a/FileBrowser/Result.swift +++ b/FileBrowser/FBResult.swift @@ -1,5 +1,5 @@ // -// Result.swift +// FBResult.swift // FileBrowser // // Created by Carl Julius Gödecken on 01/01/2017. @@ -8,7 +8,7 @@ import Foundation -public enum Result { +public enum FBResult { case success(T) case error(Error) } diff --git a/FileBrowser/FileBrowserDataSource.swift b/FileBrowser/FileBrowserDataSource.swift index 2d48f68..394f21e 100644 --- a/FileBrowser/FileBrowserDataSource.swift +++ b/FileBrowser/FileBrowserDataSource.swift @@ -10,7 +10,7 @@ import Foundation public protocol FileBrowserDataSource { var rootDirectory: FBFile { get } - func provideContents(ofDirectory directory: FBFile, callback: @escaping (Result<[FBFile]>) -> ()) + func provideContents(ofDirectory directory: FBFile, callback: @escaping (FBResult<[FBFile]>) -> ()) func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? func data(forFile file: FBFile) throws -> Data diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index 55930c6..f7b9452 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -27,7 +27,7 @@ class LocalFileParser: FileBrowserDataSource { return FBFile(path: url) } - func provideContents(ofDirectory directory: FBFile, callback: @escaping (Result<[FBFile]>) -> ()) { + func provideContents(ofDirectory directory: FBFile, callback: @escaping (FBResult<[FBFile]>) -> ()) { // Get contents do { diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index c32b86c..1eb8046 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -33,7 +33,7 @@ open class CustomDataSource: FileBrowserDataSource { let fileManager = FileManager.default - open func provideContents(ofDirectory directory: FBFile, callback: @escaping (Result<[FBFile]>) -> ()) { + open func provideContents(ofDirectory directory: FBFile, callback: @escaping (FBResult<[FBFile]>) -> ()) { // traverse the file tree outlined in the JSON file to find the directory let pathComponents = Array(directory.path.pathComponents.dropFirst()) // we're already in the root directory at the root of our json document do { From 7b901c2c530d272175df6ec1b992e73dcd899436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Tue, 9 May 2017 22:15:14 +0200 Subject: [PATCH 33/36] Remove unnecessary optional cast --- FileBrowser/LoadingViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FileBrowser/LoadingViewController.swift b/FileBrowser/LoadingViewController.swift index f2ca753..1d48134 100644 --- a/FileBrowser/LoadingViewController.swift +++ b/FileBrowser/LoadingViewController.swift @@ -112,7 +112,7 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe } func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { - if let error = error, (error as? NSError)?.code != NSURLErrorCancelled { + if let error = error, (error as NSError).code != NSURLErrorCancelled { show(error: error) } session.finishTasksAndInvalidate() From 4452e85bb9ce06fd9b5f271acfa892001ce4a184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Thu, 11 May 2017 10:03:26 +0200 Subject: [PATCH 34/36] Improve handling of remote files and download customization --- FileBrowser.xcodeproj/project.pbxproj | 4 ++ FileBrowser/FBFile.swift | 8 ++-- FileBrowser/FileBrowser.swift | 6 +++ FileBrowser/FileBrowserDataSource.swift | 1 - FileBrowser/FileBrowserDownloadDelegate.swift | 37 +++++++++++++++++++ FileBrowser/FileListTableView.swift | 1 + FileBrowser/FileListViewController.swift | 9 ++++- FileBrowser/LoadingViewController.swift | 30 +++++++++++---- FileBrowser/PreviewManager.swift | 6 ++- 9 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 FileBrowser/FileBrowserDownloadDelegate.swift diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 54ad981..246f090 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -41,6 +41,7 @@ C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */; }; C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; }; + C3C2AC201EC25F470060AECA /* FileBrowserDownloadDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */; }; C3D983CD1E195B9600A8CC06 /* (null) in Sources */ = {isa = PBXBuildFile; }; /* End PBXBuildFile section */ @@ -88,6 +89,7 @@ C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = ""; }; C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; + C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDownloadDelegate.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -118,6 +120,7 @@ 349A12271C707B1A005435C0 /* FBFile.swift */, C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */, C3308C8E1E3501BE00F4D125 /* FBResult.swift */, + C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */, ); name = Data; sourceTree = ""; @@ -337,6 +340,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + C3C2AC201EC25F470060AECA /* FileBrowserDownloadDelegate.swift in Sources */, 343C447A1C73CFC400D874FB /* WebviewPreviewViewContoller.swift in Sources */, C3D983CD1E195B9600A8CC06 /* (null) in Sources */, 3439AB701C6FF68C0058AF04 /* FileBrowser.swift in Sources */, diff --git a/FileBrowser/FBFile.swift b/FileBrowser/FBFile.swift index a83c2cc..6109036 100644 --- a/FileBrowser/FBFile.swift +++ b/FileBrowser/FBFile.swift @@ -17,8 +17,6 @@ open class FBFile: NSObject { open let isDirectory: Bool /// File extension. open let fileExtension: String? - /// File attributes (including size, creation date etc). - //open let fileAttributes: NSDictionary? = nil /// Describes where the resource can be found. May be a file:// or http[s]:// URL open var fileLocation: URL? @@ -37,7 +35,6 @@ open class FBFile: NSObject { */ public init(path: URL) { self.path = path - self.fileLocation = path self.isDirectory = checkDirectory(path) if self.isDirectory { @@ -57,7 +54,10 @@ open class FBFile: NSObject { } public var isRemoteFile: Bool { - return fileLocation?.scheme == "http" || fileLocation?.scheme == "https" + guard let fileLocation = fileLocation else { + return true + } + return fileLocation.scheme == "http" || fileLocation.scheme == "https" } } diff --git a/FileBrowser/FileBrowser.swift b/FileBrowser/FileBrowser.swift index b00d888..bb57f6e 100644 --- a/FileBrowser/FileBrowser.swift +++ b/FileBrowser/FileBrowser.swift @@ -36,6 +36,12 @@ open class FileBrowser: UINavigationController { } } + open var downloadDelegate: FileBrowserDownloadDelegate? { + didSet { + fileList?.downloadDelegate = downloadDelegate + } + } + /** Init to local documents folder. */ diff --git a/FileBrowser/FileBrowserDataSource.swift b/FileBrowser/FileBrowserDataSource.swift index 394f21e..0ae17fc 100644 --- a/FileBrowser/FileBrowserDataSource.swift +++ b/FileBrowser/FileBrowserDataSource.swift @@ -12,7 +12,6 @@ public protocol FileBrowserDataSource { var rootDirectory: FBFile { get } func provideContents(ofDirectory directory: FBFile, callback: @escaping (FBResult<[FBFile]>) -> ()) - func attributes(ofItemWithUrl fileUrl: URL) -> NSDictionary? func data(forFile file: FBFile) throws -> Data func dataURL(forFile file: FBFile) throws -> URL diff --git a/FileBrowser/FileBrowserDownloadDelegate.swift b/FileBrowser/FileBrowserDownloadDelegate.swift new file mode 100644 index 0000000..7f3429f --- /dev/null +++ b/FileBrowser/FileBrowserDownloadDelegate.swift @@ -0,0 +1,37 @@ +// +// FileBrowserDownloadDelegate.swift +// FileBrowser +// +// Created by Carl Gödecken on 09.05.17. +// Copyright © 2017 Carl Gödecken. +// + +import Foundation + +public protocol FileBrowserDownloadDelegate { + /// option to provide custom URLs before the download starts + /// called only if the fileLocation for a file is not set + func provideCustomDownloadUrl(for file: FBFile, completionHandler: @escaping (FBResult) -> ()) + + /// customization point e.g. for setting custom headers + func willPerformDownloadTask(for file: FBFile, using request: inout URLRequest) + + /// may be used to validate the response and throw errors before the file is displayed + func didFinishDownloading(data: Data, for file: FBFile, for task: URLSessionDownloadTask) throws +} + +extension FileBrowserDownloadDelegate { + func provideCustomDownloadUrl(for file: FBFile, completionHandler: @escaping (FBResult) -> ()) { + if let url = file.fileLocation { + completionHandler(.success(url)) + } else { + completionHandler(.error(FileBrowserDownloadError.noFileUrlGiven)) + } + } + + func didFinishDownloading(data: Data, for file: FBFile, for task: URLSessionDownloadTask) throws {} +} + +enum FileBrowserDownloadError: Error { + case noFileUrlGiven +} diff --git a/FileBrowser/FileListTableView.swift b/FileBrowser/FileListTableView.swift index e336f65..86828f3 100644 --- a/FileBrowser/FileListTableView.swift +++ b/FileBrowser/FileListTableView.swift @@ -44,6 +44,7 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate { searchController.isActive = false if selectedFile.isDirectory { let fileListViewController = FileListViewController(dataSource: dataSource, withDirectory: selectedFile) + fileListViewController.downloadDelegate = downloadDelegate fileListViewController.didSelectFile = didSelectFile self.navigationController?.pushViewController(fileListViewController, animated: true) } diff --git a/FileBrowser/FileListViewController.swift b/FileBrowser/FileListViewController.swift index 66cefac..cae5693 100644 --- a/FileBrowser/FileListViewController.swift +++ b/FileBrowser/FileListViewController.swift @@ -17,12 +17,17 @@ class FileListViewController: UIViewController { /// Data var directory: FBFile! var dataSource: FileBrowserDataSource! + var downloadDelegate: FileBrowserDownloadDelegate? { + didSet { + previewManager.downloadDelegate = downloadDelegate + } + } var didSelectFile: ((FBFile) -> ())? var files = [FBFile]() let previewManager = PreviewManager() var sections: [[FBFile]] = [] - + // Search controller var filteredFiles = [FBFile]() let searchController: UISearchController = { @@ -34,6 +39,7 @@ class FileListViewController: UIViewController { }() + //MARK: Lifecycle convenience init (dataSource: FileBrowserDataSource, withDirectory directory: FBFile) { @@ -43,6 +49,7 @@ class FileListViewController: UIViewController { // Set implicitly unwrapped optionals self.dataSource = dataSource self.directory = directory + self.previewManager.dataSource = dataSource self.title = directory.displayName diff --git a/FileBrowser/LoadingViewController.swift b/FileBrowser/LoadingViewController.swift index 1d48134..fd50a7c 100644 --- a/FileBrowser/LoadingViewController.swift +++ b/FileBrowser/LoadingViewController.swift @@ -21,6 +21,8 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe var session: URLSession! var file: FBFile! + var downloadDelegate: FileBrowserDownloadDelegate? = nil + convenience init (file: FBFile) { self.init(nibName: "LoadingViewController", bundle: Bundle(for: LoadingViewController.self)) self.file = file @@ -30,17 +32,30 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil) } -// var request: DataRequest? - override func viewDidLoad() { super.viewDidLoad() progressView.setProgress(0, animated: false) - guard let fileLocation = file.fileLocation else { - print("Error: File has no fileLocation set") - return + + if let fileLocation = file.fileLocation { + downloadFile(at: fileLocation) + } else if let downloadDelegate = downloadDelegate { + downloadDelegate.provideCustomDownloadUrl(for: file) { result in + switch result { + case .success(let url): + self.downloadFile(at: url) + case .error(let error): + self.show(error: error) + } + } + } else { + print("Error: No fileLocation and no downloadDelegate provided to download file!") } - - downloadTask = session.downloadTask(with: fileLocation) + } + + func downloadFile(at fileLocation: URL) { + var urlRequest = URLRequest(url: fileLocation) + downloadDelegate?.willPerformDownloadTask(for: file, using: &urlRequest) + downloadTask = session.downloadTask(with: urlRequest) downloadTask!.resume() } @@ -97,6 +112,7 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) { do { let data = try Data(contentsOf: location) + try downloadDelegate?.didFinishDownloading(data: data, for: file, for: downloadTask) self.showFile(data: data) } catch let error { print(error) diff --git a/FileBrowser/PreviewManager.swift b/FileBrowser/PreviewManager.swift index 0a0696e..e2bff00 100644 --- a/FileBrowser/PreviewManager.swift +++ b/FileBrowser/PreviewManager.swift @@ -13,10 +13,14 @@ class PreviewManager: NSObject, QLPreviewControllerDataSource { var file: FBFile? var fileData: Data? + var downloadDelegate: FileBrowserDownloadDelegate? + var dataSource: FileBrowserDataSource! func previewViewControllerForFile(_ file: FBFile, data: Data?, fromNavigation: Bool) -> UIViewController { if data == nil && file.isRemoteFile { - return LoadingViewController(file: file) + let loadingViewController = LoadingViewController(file: file) + loadingViewController.downloadDelegate = downloadDelegate + return loadingViewController } if file.type == .PLIST || file.type == .JSON { From afa91264fa628e46fef53922e231c148a0e0f954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Go=CC=88decken?= Date: Thu, 11 May 2017 10:04:14 +0200 Subject: [PATCH 35/36] Update build settings --- examples/Sample/Podfile.lock | 2 +- .../Sample/Sample.xcodeproj/project.pbxproj | 1504 ++++++----------- .../xcshareddata/xcschemes/Sample.xcscheme | 2 +- 3 files changed, 472 insertions(+), 1036 deletions(-) diff --git a/examples/Sample/Podfile.lock b/examples/Sample/Podfile.lock index 46d10dd..8200855 100644 --- a/examples/Sample/Podfile.lock +++ b/examples/Sample/Podfile.lock @@ -13,4 +13,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 25d6e7f3f21422400c1d0693c31a9c3655ff1c8b -COCOAPODS: 1.0.1 +COCOAPODS: 1.2.1 diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 6a7a41b..82cede4 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -1,1034 +1,470 @@ - - - - - archiveVersion - 1 - classes - - objectVersion - 46 - objects - - 28E13CD638951BF207ADFF8D - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - text.xcconfig - name - Pods-Sample.debug.xcconfig - path - Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig - sourceTree - <group> - - 46314AB0569B89DDC16A2375 - - buildActionMask - 2147483647 - files - - inputPaths - - isa - PBXShellScriptBuildPhase - name - [CP] Copy Pods Resources - outputPaths - - runOnlyForDeploymentPostprocessing - 0 - shellPath - /bin/sh - shellScript - "${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh" - - showEnvVarsInLog - 0 - - 48A199A41D8C53AC00C443D3 - - children - - 48A199AF1D8C53AC00C443D3 - 48A199AE1D8C53AC00C443D3 - 48A24C2F1D8C57390044C697 - C3BF0E051E1563F10009D12C - 7941567C86F4C287F933E7D4 - - isa - PBXGroup - sourceTree - <group> - - 48A199A51D8C53AC00C443D3 - - attributes - - LastSwiftUpdateCheck - 0800 - LastUpgradeCheck - 0810 - ORGANIZATIONNAME - Mihail Șalari - TargetAttributes - - 48A199AC1D8C53AC00C443D3 - - CreatedOnToolsVersion - 8.0 - LastSwiftMigration - 0800 - ProvisioningStyle - Automatic - - - - buildConfigurationList - 48A199A81D8C53AC00C443D3 - compatibilityVersion - Xcode 3.2 - developmentRegion - English - hasScannedForEncodings - 0 - isa - PBXProject - knownRegions - - en - Base - - mainGroup - 48A199A41D8C53AC00C443D3 - productRefGroup - 48A199AE1D8C53AC00C443D3 - projectDirPath - - projectReferences - - projectRoot - - targets - - 48A199AC1D8C53AC00C443D3 - - - 48A199A81D8C53AC00C443D3 - - buildConfigurations - - 48A199BD1D8C53AC00C443D3 - 48A199BE1D8C53AC00C443D3 - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release - isa - XCConfigurationList - - 48A199A91D8C53AC00C443D3 - - buildActionMask - 2147483647 - files - - 48A199C81D8C53E200C443D3 - 48A199C51D8C53DB00C443D3 - C3BF0DFE1E13F5340009D12C - - isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 48A199AA1D8C53AC00C443D3 - - buildActionMask - 2147483647 - files - - C3368F3D1E167B91003F4664 - 760CE3C0DC5DA79C68460A63 - - isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 48A199AB1D8C53AC00C443D3 - - buildActionMask - 2147483647 - files - - 48A199BB1D8C53AC00C443D3 - 48A199CF1D8C546000C443D3 - C3BF0E061E1563F10009D12C - 48A199B81D8C53AC00C443D3 - 48A199B61D8C53AC00C443D3 - 48A199CD1D8C546000C443D3 - 48A199D01D8C546000C443D3 - 48A199CE1D8C546000C443D3 - C3BF0E101E1591DC0009D12C - - isa - PBXResourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 48A199AC1D8C53AC00C443D3 - - buildConfigurationList - 48A199BF1D8C53AC00C443D3 - buildPhases - - FE1FF64C54996947165EA6D1 - 48A199A91D8C53AC00C443D3 - 48A199AA1D8C53AC00C443D3 - 48A199AB1D8C53AC00C443D3 - 48A199DD1D8C564100C443D3 - E5DD55652D3BD1C4AF23C734 - 46314AB0569B89DDC16A2375 - - buildRules - - dependencies - - isa - PBXNativeTarget - name - Sample - productName - Sample - productReference - 48A199AD1D8C53AC00C443D3 - productType - com.apple.product-type.application - - 48A199AD1D8C53AC00C443D3 - - explicitFileType - wrapper.application - includeInIndex - 0 - isa - PBXFileReference - path - Sample.app - sourceTree - BUILT_PRODUCTS_DIR - - 48A199AE1D8C53AC00C443D3 - - children - - 48A199AD1D8C53AC00C443D3 - - isa - PBXGroup - name - Products - sourceTree - <group> - - 48A199AF1D8C53AC00C443D3 - - children - - 48A199D21D8C546F00C443D3 - 48A199C21D8C53B700C443D3 - - isa - PBXGroup - path - Sample - sourceTree - <group> - - 48A199B41D8C53AC00C443D3 - - children - - 48A199B51D8C53AC00C443D3 - - isa - PBXVariantGroup - name - Main.storyboard - sourceTree - <group> - - 48A199B51D8C53AC00C443D3 - - isa - PBXFileReference - lastKnownFileType - file.storyboard - name - Base - path - Base.lproj/Main.storyboard - sourceTree - <group> - - 48A199B61D8C53AC00C443D3 - - fileRef - 48A199B41D8C53AC00C443D3 - isa - PBXBuildFile - - 48A199B71D8C53AC00C443D3 - - isa - PBXFileReference - lastKnownFileType - folder.assetcatalog - path - Assets.xcassets - sourceTree - <group> - - 48A199B81D8C53AC00C443D3 - - fileRef - 48A199B71D8C53AC00C443D3 - isa - PBXBuildFile - - 48A199B91D8C53AC00C443D3 - - children - - 48A199BA1D8C53AC00C443D3 - - isa - PBXVariantGroup - name - LaunchScreen.storyboard - sourceTree - <group> - - 48A199BA1D8C53AC00C443D3 - - isa - PBXFileReference - lastKnownFileType - file.storyboard - name - Base - path - Base.lproj/LaunchScreen.storyboard - sourceTree - <group> - - 48A199BB1D8C53AC00C443D3 - - fileRef - 48A199B91D8C53AC00C443D3 - isa - PBXBuildFile - - 48A199BD1D8C53AC00C443D3 - - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - CLANG_ANALYZER_NONNULL - YES - CLANG_CXX_LANGUAGE_STANDARD - gnu++0x - CLANG_CXX_LIBRARY - libc++ - CLANG_ENABLE_MODULES - YES - CLANG_ENABLE_OBJC_ARC - YES - CLANG_WARN_BOOL_CONVERSION - YES - CLANG_WARN_CONSTANT_CONVERSION - YES - CLANG_WARN_DIRECT_OBJC_ISA_USAGE - YES_ERROR - CLANG_WARN_DOCUMENTATION_COMMENTS - YES - CLANG_WARN_EMPTY_BODY - YES - CLANG_WARN_ENUM_CONVERSION - YES - CLANG_WARN_INFINITE_RECURSION - YES - CLANG_WARN_INT_CONVERSION - YES - CLANG_WARN_OBJC_ROOT_CLASS - YES_ERROR - CLANG_WARN_SUSPICIOUS_MOVE - YES - CLANG_WARN_SUSPICIOUS_MOVES - YES - CLANG_WARN_UNREACHABLE_CODE - YES - CLANG_WARN__DUPLICATE_METHOD_MATCH - YES - COPY_PHASE_STRIP - NO - DEBUG_INFORMATION_FORMAT - dwarf - ENABLE_STRICT_OBJC_MSGSEND - YES - ENABLE_TESTABILITY - YES - GCC_C_LANGUAGE_STANDARD - gnu99 - GCC_DYNAMIC_NO_PIC - NO - GCC_NO_COMMON_BLOCKS - YES - GCC_OPTIMIZATION_LEVEL - 0 - GCC_PREPROCESSOR_DEFINITIONS - - DEBUG=1 - $(inherited) - - GCC_WARN_64_TO_32_BIT_CONVERSION - YES - GCC_WARN_ABOUT_RETURN_TYPE - YES_ERROR - GCC_WARN_UNDECLARED_SELECTOR - YES - GCC_WARN_UNINITIALIZED_AUTOS - YES_AGGRESSIVE - GCC_WARN_UNUSED_FUNCTION - YES - GCC_WARN_UNUSED_VARIABLE - YES - IPHONEOS_DEPLOYMENT_TARGET - 10.0 - MTL_ENABLE_DEBUG_INFO - YES - ONLY_ACTIVE_ARCH - YES - SDKROOT - iphoneos - SWIFT_ACTIVE_COMPILATION_CONDITIONS - DEBUG - SWIFT_OPTIMIZATION_LEVEL - -Onone - TARGETED_DEVICE_FAMILY - 1,2 - - isa - XCBuildConfiguration - name - Debug - - 48A199BE1D8C53AC00C443D3 - - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - CLANG_ANALYZER_NONNULL - YES - CLANG_CXX_LANGUAGE_STANDARD - gnu++0x - CLANG_CXX_LIBRARY - libc++ - CLANG_ENABLE_MODULES - YES - CLANG_ENABLE_OBJC_ARC - YES - CLANG_WARN_BOOL_CONVERSION - YES - CLANG_WARN_CONSTANT_CONVERSION - YES - CLANG_WARN_DIRECT_OBJC_ISA_USAGE - YES_ERROR - CLANG_WARN_DOCUMENTATION_COMMENTS - YES - CLANG_WARN_EMPTY_BODY - YES - CLANG_WARN_ENUM_CONVERSION - YES - CLANG_WARN_INFINITE_RECURSION - YES - CLANG_WARN_INT_CONVERSION - YES - CLANG_WARN_OBJC_ROOT_CLASS - YES_ERROR - CLANG_WARN_SUSPICIOUS_MOVE - YES - CLANG_WARN_SUSPICIOUS_MOVES - YES - CLANG_WARN_UNREACHABLE_CODE - YES - CLANG_WARN__DUPLICATE_METHOD_MATCH - YES - COPY_PHASE_STRIP - NO - DEBUG_INFORMATION_FORMAT - dwarf-with-dsym - ENABLE_NS_ASSERTIONS - NO - ENABLE_STRICT_OBJC_MSGSEND - YES - GCC_C_LANGUAGE_STANDARD - gnu99 - GCC_NO_COMMON_BLOCKS - YES - GCC_WARN_64_TO_32_BIT_CONVERSION - YES - GCC_WARN_ABOUT_RETURN_TYPE - YES_ERROR - GCC_WARN_UNDECLARED_SELECTOR - YES - GCC_WARN_UNINITIALIZED_AUTOS - YES_AGGRESSIVE - GCC_WARN_UNUSED_FUNCTION - YES - GCC_WARN_UNUSED_VARIABLE - YES - IPHONEOS_DEPLOYMENT_TARGET - 10.0 - MTL_ENABLE_DEBUG_INFO - NO - SDKROOT - iphoneos - SWIFT_OPTIMIZATION_LEVEL - -Owholemodule - TARGETED_DEVICE_FAMILY - 1,2 - VALIDATE_PRODUCT - YES - - isa - XCBuildConfiguration - name - Release - - 48A199BF1D8C53AC00C443D3 - - buildConfigurations - - 48A199C01D8C53AC00C443D3 - 48A199C11D8C53AC00C443D3 - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release - isa - XCConfigurationList - - 48A199C01D8C53AC00C443D3 - - baseConfigurationReference - 28E13CD638951BF207ADFF8D - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - ASSETCATALOG_COMPILER_APPICON_NAME - AppIcon - CLANG_ENABLE_MODULES - YES - DEVELOPMENT_TEAM - - INFOPLIST_FILE - $(SRCROOT)/Sample/Supporting Files/Info.plist - LD_RUNPATH_SEARCH_PATHS - $(inherited) @executable_path/Frameworks - PRODUCT_BUNDLE_IDENTIFIER - com.mihailsalari.Sample - PRODUCT_NAME - $(TARGET_NAME) - SWIFT_OPTIMIZATION_LEVEL - -Onone - SWIFT_VERSION - 3.0 - - isa - XCBuildConfiguration - name - Debug - - 48A199C11D8C53AC00C443D3 - - baseConfigurationReference - FFE0589B53B1161442905147 - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - ASSETCATALOG_COMPILER_APPICON_NAME - AppIcon - CLANG_ENABLE_MODULES - YES - DEVELOPMENT_TEAM - - INFOPLIST_FILE - $(SRCROOT)/Sample/Supporting Files/Info.plist - LD_RUNPATH_SEARCH_PATHS - $(inherited) @executable_path/Frameworks - PRODUCT_BUNDLE_IDENTIFIER - com.mihailsalari.Sample - PRODUCT_NAME - $(TARGET_NAME) - SWIFT_VERSION - 3.0 - - isa - XCBuildConfiguration - name - Release - - 48A199C21D8C53B700C443D3 - - children - - 48A199D11D8C546500C443D3 - 48A199C31D8C53DB00C443D3 - C3BF0DFD1E13F5340009D12C - 48A199C41D8C53DB00C443D3 - 48A199B41D8C53AC00C443D3 - 48A199B71D8C53AC00C443D3 - 48A199B91D8C53AC00C443D3 - - isa - PBXGroup - name - Supporting Files - sourceTree - <group> - - 48A199C31D8C53DB00C443D3 - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - sourcecode.swift - name - AppDelegate.swift - path - Supporting Files/AppDelegate.swift - sourceTree - <group> - - 48A199C41D8C53DB00C443D3 - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - text.plist.xml - name - Info.plist - path - Supporting Files/Info.plist - sourceTree - <group> - - 48A199C51D8C53DB00C443D3 - - fileRef - 48A199C31D8C53DB00C443D3 - isa - PBXBuildFile - - 48A199C71D8C53E200C443D3 - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - sourcecode.swift - name - MainViewController.swift - path - View Controller/MainViewController.swift - sourceTree - <group> - - 48A199C81D8C53E200C443D3 - - fileRef - 48A199C71D8C53E200C443D3 - isa - PBXBuildFile - - 48A199C91D8C546000C443D3 - - isa - PBXFileReference - lastKnownFileType - image.jpeg - path - Baymax.jpg - sourceTree - <group> - - 48A199CA1D8C546000C443D3 - - isa - PBXFileReference - lastKnownFileType - image.jpeg - path - BB8.jpg - sourceTree - <group> - - 48A199CB1D8C546000C443D3 - - isa - PBXFileReference - lastKnownFileType - archive.zip - path - Images.zip - sourceTree - <group> - - 48A199CC1D8C546000C443D3 - - isa - PBXFileReference - lastKnownFileType - image.jpeg - path - Stitch.jpg - sourceTree - <group> - - 48A199CD1D8C546000C443D3 - - fileRef - 48A199C91D8C546000C443D3 - isa - PBXBuildFile - - 48A199CE1D8C546000C443D3 - - fileRef - 48A199CA1D8C546000C443D3 - isa - PBXBuildFile - - 48A199CF1D8C546000C443D3 - - fileRef - 48A199CB1D8C546000C443D3 - isa - PBXBuildFile - - 48A199D01D8C546000C443D3 - - fileRef - 48A199CC1D8C546000C443D3 - isa - PBXBuildFile - - 48A199D11D8C546500C443D3 - - children - - 48A199C91D8C546000C443D3 - 48A199CA1D8C546000C443D3 - 48A199CB1D8C546000C443D3 - 48A199CC1D8C546000C443D3 - C3BF0E0F1E1591DC0009D12C - - isa - PBXGroup - name - Resources - sourceTree - <group> - - 48A199D21D8C546F00C443D3 - - children - - 48A199C71D8C53E200C443D3 - - isa - PBXGroup - name - View Controller - sourceTree - <group> - - 48A199DD1D8C564100C443D3 - - buildActionMask - 2147483647 - dstPath - - dstSubfolderSpec - 10 - files - - isa - PBXCopyFilesBuildPhase - name - Embed Frameworks - runOnlyForDeploymentPostprocessing - 0 - - 48A24C2F1D8C57390044C697 - - children - - C3368F3C1E167B91003F4664 - C3BF0E0B1E15723A0009D12C - C3BF0E071E156BE60009D12C - 48A24C321D8C59250044C697 - D2C28D7CA33CEE3E4A364447 - - isa - PBXGroup - name - Frameworks - sourceTree - <group> - - 48A24C321D8C59250044C697 - - isa - PBXFileReference - lastKnownFileType - wrapper.framework - name - FileBrowser.framework - path - ../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework - sourceTree - <group> - - 760CE3C0DC5DA79C68460A63 - - fileRef - D2C28D7CA33CEE3E4A364447 - isa - PBXBuildFile - - 7941567C86F4C287F933E7D4 - - children - - 28E13CD638951BF207ADFF8D - FFE0589B53B1161442905147 - - isa - PBXGroup - name - Pods - sourceTree - <group> - - C3368F3C1E167B91003F4664 - - isa - PBXFileReference - lastKnownFileType - wrapper.framework - name - FileBrowser.framework - path - ../../build/Debug-iphoneos/FileBrowser.framework - sourceTree - <group> - - C3368F3D1E167B91003F4664 - - fileRef - C3368F3C1E167B91003F4664 - isa - PBXBuildFile - - C3BF0DFD1E13F5340009D12C - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - sourcecode.swift - path - CustomDataSource.swift - sourceTree - <group> - - C3BF0DFE1E13F5340009D12C - - fileRef - C3BF0DFD1E13F5340009D12C - isa - PBXBuildFile - - C3BF0E051E1563F10009D12C - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - text - path - Podfile - sourceTree - <group> - xcLanguageSpecificationIdentifier - xcode.lang.ruby - - C3BF0E061E1563F10009D12C - - fileRef - C3BF0E051E1563F10009D12C - isa - PBXBuildFile - - C3BF0E071E156BE60009D12C - - isa - PBXFileReference - lastKnownFileType - wrapper.framework - name - FileBrowser.framework - path - ../../build/Debug-iphoneos/FileBrowser.framework - sourceTree - <group> - - C3BF0E0B1E15723A0009D12C - - isa - PBXFileReference - lastKnownFileType - wrapper.framework - name - FileBrowser.framework - path - ../../build/Debug-iphoneos/FileBrowser.framework - sourceTree - <group> - - C3BF0E0F1E1591DC0009D12C - - fileEncoding - 4 - isa - PBXFileReference - lastKnownFileType - text.json - path - folderContent.json - sourceTree - <group> - - C3BF0E101E1591DC0009D12C - - fileRef - C3BF0E0F1E1591DC0009D12C - isa - PBXBuildFile - - D2C28D7CA33CEE3E4A364447 - - explicitFileType - wrapper.framework - includeInIndex - 0 - isa - PBXFileReference - path - Pods_Sample.framework - sourceTree - BUILT_PRODUCTS_DIR - - E5DD55652D3BD1C4AF23C734 - - buildActionMask - 2147483647 - files - - inputPaths - - isa - PBXShellScriptBuildPhase - name - [CP] Embed Pods Frameworks - outputPaths - - runOnlyForDeploymentPostprocessing - 0 - shellPath - /bin/sh - shellScript - "${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh" - - showEnvVarsInLog - 0 - - FE1FF64C54996947165EA6D1 - - buildActionMask - 2147483647 - files - - inputPaths - - isa - PBXShellScriptBuildPhase - name - [CP] Check Pods Manifest.lock - outputPaths - - runOnlyForDeploymentPostprocessing - 0 - shellPath - /bin/sh - shellScript - diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null -if [[ $? != 0 ]] ; then - cat << EOM -error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. -EOM - exit 1 -fi - - showEnvVarsInLog - 0 - - FFE0589B53B1161442905147 - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - text.xcconfig - name - Pods-Sample.release.xcconfig - path - Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig - sourceTree - <group> - - - rootObject - 48A199A51D8C53AC00C443D3 - - +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 48A199B61D8C53AC00C443D3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48A199B41D8C53AC00C443D3 /* Main.storyboard */; }; + 48A199B81D8C53AC00C443D3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 48A199B71D8C53AC00C443D3 /* Assets.xcassets */; }; + 48A199BB1D8C53AC00C443D3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48A199B91D8C53AC00C443D3 /* LaunchScreen.storyboard */; }; + 48A199C51D8C53DB00C443D3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A199C31D8C53DB00C443D3 /* AppDelegate.swift */; }; + 48A199C81D8C53E200C443D3 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A199C71D8C53E200C443D3 /* MainViewController.swift */; }; + 48A199CD1D8C546000C443D3 /* Baymax.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199C91D8C546000C443D3 /* Baymax.jpg */; }; + 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CA1D8C546000C443D3 /* BB8.jpg */; }; + 48A199CF1D8C546000C443D3 /* Images.zip in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CB1D8C546000C443D3 /* Images.zip */; }; + 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 48A199CC1D8C546000C443D3 /* Stitch.jpg */; }; + 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */; }; + C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3368F3C1E167B91003F4664 /* FileBrowser.framework */; }; + C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */; }; + C3BF0E061E1563F10009D12C /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E051E1563F10009D12C /* Podfile */; }; + C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0E0F1E1591DC0009D12C /* folderContent.json */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 48A199DD1D8C564100C443D3 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; + 48A199AD1D8C53AC00C443D3 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 48A199B51D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 48A199B71D8C53AC00C443D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 48A199BA1D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 48A199C31D8C53DB00C443D3 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = "Supporting Files/AppDelegate.swift"; sourceTree = ""; }; + 48A199C41D8C53DB00C443D3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Supporting Files/Info.plist"; sourceTree = ""; }; + 48A199C71D8C53E200C443D3 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MainViewController.swift; path = "View Controller/MainViewController.swift"; sourceTree = ""; }; + 48A199C91D8C546000C443D3 /* Baymax.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Baymax.jpg; sourceTree = ""; }; + 48A199CA1D8C546000C443D3 /* BB8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = BB8.jpg; sourceTree = ""; }; + 48A199CB1D8C546000C443D3 /* Images.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Images.zip; sourceTree = ""; }; + 48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; + 48A24C321D8C59250044C697 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + C3368F3C1E167B91003F4664 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDataSource.swift; sourceTree = ""; }; + C3BF0E051E1563F10009D12C /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + C3BF0E071E156BE60009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; + C3BF0E0F1E1591DC0009D12C /* folderContent.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = folderContent.json; sourceTree = ""; }; + D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 48A199AA1D8C53AC00C443D3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C3368F3D1E167B91003F4664 /* FileBrowser.framework in Frameworks */, + 760CE3C0DC5DA79C68460A63 /* Pods_Sample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 48A199A41D8C53AC00C443D3 = { + isa = PBXGroup; + children = ( + 48A199AF1D8C53AC00C443D3 /* Sample */, + 48A199AE1D8C53AC00C443D3 /* Products */, + 48A24C2F1D8C57390044C697 /* Frameworks */, + C3BF0E051E1563F10009D12C /* Podfile */, + 7941567C86F4C287F933E7D4 /* Pods */, + ); + sourceTree = ""; + }; + 48A199AE1D8C53AC00C443D3 /* Products */ = { + isa = PBXGroup; + children = ( + 48A199AD1D8C53AC00C443D3 /* Sample.app */, + ); + name = Products; + sourceTree = ""; + }; + 48A199AF1D8C53AC00C443D3 /* Sample */ = { + isa = PBXGroup; + children = ( + 48A199D21D8C546F00C443D3 /* View Controller */, + 48A199C21D8C53B700C443D3 /* Supporting Files */, + ); + path = Sample; + sourceTree = ""; + }; + 48A199C21D8C53B700C443D3 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 48A199D11D8C546500C443D3 /* Resources */, + 48A199C31D8C53DB00C443D3 /* AppDelegate.swift */, + C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */, + 48A199C41D8C53DB00C443D3 /* Info.plist */, + 48A199B41D8C53AC00C443D3 /* Main.storyboard */, + 48A199B71D8C53AC00C443D3 /* Assets.xcassets */, + 48A199B91D8C53AC00C443D3 /* LaunchScreen.storyboard */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 48A199D11D8C546500C443D3 /* Resources */ = { + isa = PBXGroup; + children = ( + 48A199C91D8C546000C443D3 /* Baymax.jpg */, + 48A199CA1D8C546000C443D3 /* BB8.jpg */, + 48A199CB1D8C546000C443D3 /* Images.zip */, + 48A199CC1D8C546000C443D3 /* Stitch.jpg */, + C3BF0E0F1E1591DC0009D12C /* folderContent.json */, + ); + name = Resources; + sourceTree = ""; + }; + 48A199D21D8C546F00C443D3 /* View Controller */ = { + isa = PBXGroup; + children = ( + 48A199C71D8C53E200C443D3 /* MainViewController.swift */, + ); + name = "View Controller"; + sourceTree = ""; + }; + 48A24C2F1D8C57390044C697 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C3368F3C1E167B91003F4664 /* FileBrowser.framework */, + C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */, + C3BF0E071E156BE60009D12C /* FileBrowser.framework */, + 48A24C321D8C59250044C697 /* FileBrowser.framework */, + D2C28D7CA33CEE3E4A364447 /* Pods_Sample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7941567C86F4C287F933E7D4 /* Pods */ = { + isa = PBXGroup; + children = ( + 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */, + FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 48A199AC1D8C53AC00C443D3 /* Sample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */; + buildPhases = ( + FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */, + 48A199A91D8C53AC00C443D3 /* Sources */, + 48A199AA1D8C53AC00C443D3 /* Frameworks */, + 48A199AB1D8C53AC00C443D3 /* Resources */, + 48A199DD1D8C564100C443D3 /* Embed Frameworks */, + E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */, + 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Sample; + productName = Sample; + productReference = 48A199AD1D8C53AC00C443D3 /* Sample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 48A199A51D8C53AC00C443D3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0800; + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = "Mihail Șalari"; + TargetAttributes = { + 48A199AC1D8C53AC00C443D3 = { + CreatedOnToolsVersion = 8.0; + LastSwiftMigration = 0800; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 48A199A81D8C53AC00C443D3 /* Build configuration list for PBXProject "Sample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 48A199A41D8C53AC00C443D3; + productRefGroup = 48A199AE1D8C53AC00C443D3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 48A199AC1D8C53AC00C443D3 /* Sample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 48A199AB1D8C53AC00C443D3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48A199BB1D8C53AC00C443D3 /* LaunchScreen.storyboard in Resources */, + 48A199CF1D8C546000C443D3 /* Images.zip in Resources */, + C3BF0E061E1563F10009D12C /* Podfile in Resources */, + 48A199B81D8C53AC00C443D3 /* Assets.xcassets in Resources */, + 48A199B61D8C53AC00C443D3 /* Main.storyboard in Resources */, + 48A199CD1D8C546000C443D3 /* Baymax.jpg in Resources */, + 48A199D01D8C546000C443D3 /* Stitch.jpg in Resources */, + 48A199CE1D8C546000C443D3 /* BB8.jpg in Resources */, + C3BF0E101E1591DC0009D12C /* folderContent.json in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 46314AB0569B89DDC16A2375 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + E5DD55652D3BD1C4AF23C734 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + FE1FF64C54996947165EA6D1 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 48A199A91D8C53AC00C443D3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 48A199C81D8C53E200C443D3 /* MainViewController.swift in Sources */, + 48A199C51D8C53DB00C443D3 /* AppDelegate.swift in Sources */, + C3BF0DFE1E13F5340009D12C /* CustomDataSource.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 48A199B41D8C53AC00C443D3 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 48A199B51D8C53AC00C443D3 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 48A199B91D8C53AC00C443D3 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 48A199BA1D8C53AC00C443D3 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 48A199BD1D8C53AC00C443D3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 48A199BE1D8C53AC00C443D3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 48A199C01D8C53AC00C443D3 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 28E13CD638951BF207ADFF8D /* Pods-Sample.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.mihailsalari.Sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 48A199C11D8C53AC00C443D3 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FFE0589B53B1161442905147 /* Pods-Sample.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.mihailsalari.Sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 48A199A81D8C53AC00C443D3 /* Build configuration list for PBXProject "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48A199BD1D8C53AC00C443D3 /* Debug */, + 48A199BE1D8C53AC00C443D3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48A199C01D8C53AC00C443D3 /* Debug */, + 48A199C11D8C53AC00C443D3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 48A199A51D8C53AC00C443D3 /* Project object */; +} diff --git a/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme b/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme index 5147bbd..b61189c 100644 --- a/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme +++ b/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme @@ -1,6 +1,6 @@ Date: Thu, 11 May 2017 12:17:49 +0200 Subject: [PATCH 36/36] Make FBFile a protocol, change fileLocation to resourceUrl --- FileBrowser.xcodeproj/project.pbxproj | 14 ++++------ FileBrowser/FBFile.swift | 28 ++++++++++++++----- FileBrowser/FileBrowserDataSource.swift | 3 +- FileBrowser/FileBrowserDownloadDelegate.swift | 4 +-- FileBrowser/FileParser.swift | 4 +-- FileBrowser/LoadingViewController.swift | 10 +++---- FileBrowser/PreviewManager.swift | 2 +- .../PreviewTransitionViewController.swift | 10 +++++++ FileBrowser/WebviewPreviewViewContoller.swift | 4 +-- .../Sample/Sample.xcodeproj/project.pbxproj | 2 +- examples/Sample/Sample/CustomDataSource.swift | 10 +++---- 11 files changed, 56 insertions(+), 35 deletions(-) diff --git a/FileBrowser.xcodeproj/project.pbxproj b/FileBrowser.xcodeproj/project.pbxproj index 246f090..f94199b 100644 --- a/FileBrowser.xcodeproj/project.pbxproj +++ b/FileBrowser.xcodeproj/project.pbxproj @@ -42,7 +42,6 @@ C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */; }; C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; }; C3C2AC201EC25F470060AECA /* FileBrowserDownloadDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */; }; - C3D983CD1E195B9600A8CC06 /* (null) in Sources */ = {isa = PBXBuildFile; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -62,9 +61,9 @@ 3439AB6B1C6FD6650058AF04 /* FileListPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListPreview.swift; sourceTree = ""; }; 3439AB6F1C6FF68C0058AF04 /* FileBrowser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileBrowser.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 343C44611C73CC8100D874FB /* PreviewTransitionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewTransitionViewController.swift; sourceTree = ""; }; - 343C44651C73CD3200D874FB /* PreviewManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewManager.swift; sourceTree = ""; }; + 343C44651C73CD3200D874FB /* PreviewManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = PreviewManager.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 343C44671C73CD8700D874FB /* PreviewTransitionViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreviewTransitionViewController.xib; sourceTree = ""; }; - 343C44781C73CFC400D874FB /* WebviewPreviewViewContoller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebviewPreviewViewContoller.swift; sourceTree = ""; }; + 343C44781C73CFC400D874FB /* WebviewPreviewViewContoller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = WebviewPreviewViewContoller.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 343C447C1C73CFD900D874FB /* WebviewPreviewViewContoller.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WebviewPreviewViewContoller.xib; sourceTree = ""; }; 343C447E1C73D06200D874FB /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 344169541C67812400B93D28 /* FileBrowser.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FileBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -77,7 +76,7 @@ 3441DC621C712370005CC2FA /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; 349A12231C70725D005435C0 /* FileListSearch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListSearch.swift; sourceTree = ""; }; 349A12251C707317005435C0 /* FileListTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListTableView.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 349A12271C707B1A005435C0 /* FBFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FBFile.swift; sourceTree = ""; }; + 349A12271C707B1A005435C0 /* FBFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FBFile.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 349A122B1C707E86005435C0 /* documents@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "documents@2x.png"; sourceTree = ""; }; 349A122C1C707E86005435C0 /* file@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "file@2x.png"; sourceTree = ""; }; 349A122D1C707E86005435C0 /* FileBrowser.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FileBrowser.xib; sourceTree = ""; }; @@ -88,8 +87,8 @@ C3308C8E1E3501BE00F4D125 /* FBResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FBResult.swift; sourceTree = ""; }; C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = ""; }; C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = ""; }; - C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; - C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDownloadDelegate.swift; sourceTree = ""; }; + C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = LoadingViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; + C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileBrowserDownloadDelegate.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -340,15 +339,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 349A12281C707B1A005435C0 /* FBFile.swift in Sources */, C3C2AC201EC25F470060AECA /* FileBrowserDownloadDelegate.swift in Sources */, 343C447A1C73CFC400D874FB /* WebviewPreviewViewContoller.swift in Sources */, - C3D983CD1E195B9600A8CC06 /* (null) in Sources */, 3439AB701C6FF68C0058AF04 /* FileBrowser.swift in Sources */, 349A12261C707317005435C0 /* FileListTableView.swift in Sources */, C3308C8F1E3501BE00F4D125 /* FBResult.swift in Sources */, 343C44661C73CD3200D874FB /* PreviewManager.swift in Sources */, 3439AB681C6F203A0058AF04 /* FileParser.swift in Sources */, - 349A12281C707B1A005435C0 /* FBFile.swift in Sources */, 343C44631C73CC8100D874FB /* PreviewTransitionViewController.swift in Sources */, C3BF0DFC1E13F4A80009D12C /* FileBrowserDataSource.swift in Sources */, 3437405B1C6E7DA50090FD6A /* FileListViewController.swift in Sources */, diff --git a/FileBrowser/FBFile.swift b/FileBrowser/FBFile.swift index 6109036..46247f1 100644 --- a/FileBrowser/FBFile.swift +++ b/FileBrowser/FBFile.swift @@ -10,7 +10,22 @@ import Foundation import UIKit /// FBFile is a class representing a file in FileBrowser -open class FBFile: NSObject { +public protocol FBFile { + var displayName: String { get } + + /// Describes the path in the current file system, e.g. /dir/file.txt + var path: URL { get } + + /// Describes where the resource can be found. May be a file:// or http[s]:// URL + var resourceUrl: URL? { get } + + var isDirectory: Bool { get } + var fileExtension: String? { get } + var type: FBFileType { get } + var isRemoteFile: Bool { get } +} + +open class BasicFBFile: NSObject, FBFile { /// Display name. String. open var displayName: String // is Directory. Bool. @@ -18,12 +33,11 @@ open class FBFile: NSObject { /// File extension. open let fileExtension: String? - /// Describes where the resource can be found. May be a file:// or http[s]:// URL - open var fileLocation: URL? + open var resourceUrl: URL? // FBFileType open var type: FBFileType - /// Describes the path in the current file system, e.g. /dir/file.txt + open let path: URL /** @@ -54,10 +68,10 @@ open class FBFile: NSObject { } public var isRemoteFile: Bool { - guard let fileLocation = fileLocation else { + guard let resourceUrl = resourceUrl else { return true } - return fileLocation.scheme == "http" || fileLocation.scheme == "https" + return resourceUrl.scheme == "http" || resourceUrl.scheme == "https" } } @@ -90,7 +104,7 @@ public enum FBFileType: String { - returns: UIImage for file type */ public func image() -> UIImage? { - let bundle = Bundle(for: FBFile.self) + let bundle = Bundle(for: FileBrowser.self) var fileName = String() switch self { case .Directory: fileName = "folder@2x.png" diff --git a/FileBrowser/FileBrowserDataSource.swift b/FileBrowser/FileBrowserDataSource.swift index 0ae17fc..c1037b0 100644 --- a/FileBrowser/FileBrowserDataSource.swift +++ b/FileBrowser/FileBrowserDataSource.swift @@ -13,7 +13,6 @@ public protocol FileBrowserDataSource { func provideContents(ofDirectory directory: FBFile, callback: @escaping (FBResult<[FBFile]>) -> ()) func data(forFile file: FBFile) throws -> Data - func dataURL(forFile file: FBFile) throws -> URL var excludesFileExtensions: [String]? { get set } var excludesFilepaths: [URL]? { get set } @@ -21,7 +20,7 @@ public protocol FileBrowserDataSource { extension FileBrowserDataSource { public func data(forFile file: FBFile) throws -> Data { - let url = try dataURL(forFile: file) + let url = file.resourceUrl! return try Data(contentsOf: url) } } diff --git a/FileBrowser/FileBrowserDownloadDelegate.swift b/FileBrowser/FileBrowserDownloadDelegate.swift index 7f3429f..1e9bedb 100644 --- a/FileBrowser/FileBrowserDownloadDelegate.swift +++ b/FileBrowser/FileBrowserDownloadDelegate.swift @@ -10,7 +10,7 @@ import Foundation public protocol FileBrowserDownloadDelegate { /// option to provide custom URLs before the download starts - /// called only if the fileLocation for a file is not set + /// called only if the resourceUrl for a file is not set func provideCustomDownloadUrl(for file: FBFile, completionHandler: @escaping (FBResult) -> ()) /// customization point e.g. for setting custom headers @@ -22,7 +22,7 @@ public protocol FileBrowserDownloadDelegate { extension FileBrowserDownloadDelegate { func provideCustomDownloadUrl(for file: FBFile, completionHandler: @escaping (FBResult) -> ()) { - if let url = file.fileLocation { + if let url = file.resourceUrl { completionHandler(.success(url)) } else { completionHandler(.error(FileBrowserDownloadError.noFileUrlGiven)) diff --git a/FileBrowser/FileParser.swift b/FileBrowser/FileParser.swift index f7b9452..209546e 100644 --- a/FileBrowser/FileParser.swift +++ b/FileBrowser/FileParser.swift @@ -24,7 +24,7 @@ class LocalFileParser: FileBrowserDataSource { var rootDirectory: FBFile { let url = customRootUrl ?? defaultRootUrl - return FBFile(path: url) + return BasicFBFile(path: url) } func provideContents(ofDirectory directory: FBFile, callback: @escaping (FBResult<[FBFile]>) -> ()) { @@ -35,7 +35,7 @@ class LocalFileParser: FileBrowserDataSource { // Filter - var files = filePaths.map(FBFile.init) + var files = filePaths.map(BasicFBFile.init) if let excludesFileExtensions = excludesFileExtensions { let lowercased = excludesFileExtensions.map { $0.lowercased() } files = files.filter { !lowercased.contains($0.fileExtension?.lowercased() ?? "") } diff --git a/FileBrowser/LoadingViewController.swift b/FileBrowser/LoadingViewController.swift index fd50a7c..615c200 100644 --- a/FileBrowser/LoadingViewController.swift +++ b/FileBrowser/LoadingViewController.swift @@ -36,8 +36,8 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe super.viewDidLoad() progressView.setProgress(0, animated: false) - if let fileLocation = file.fileLocation { - downloadFile(at: fileLocation) + if let resourceUrl = file.resourceUrl { + downloadFile(at: resourceUrl) } else if let downloadDelegate = downloadDelegate { downloadDelegate.provideCustomDownloadUrl(for: file) { result in switch result { @@ -48,12 +48,12 @@ class LoadingViewController: UIViewController, URLSessionDownloadDelegate, URLSe } } } else { - print("Error: No fileLocation and no downloadDelegate provided to download file!") + print("Error: No resourceUrl and no downloadDelegate provided to download file!") } } - func downloadFile(at fileLocation: URL) { - var urlRequest = URLRequest(url: fileLocation) + func downloadFile(at resourceUrl: URL) { + var urlRequest = URLRequest(url: resourceUrl) downloadDelegate?.willPerformDownloadTask(for: file, using: &urlRequest) downloadTask = session.downloadTask(with: urlRequest) downloadTask!.resume() diff --git a/FileBrowser/PreviewManager.swift b/FileBrowser/PreviewManager.swift index e2bff00..04522cf 100644 --- a/FileBrowser/PreviewManager.swift +++ b/FileBrowser/PreviewManager.swift @@ -55,7 +55,7 @@ class PreviewManager: NSObject, QLPreviewControllerDataSource { let fileData = fileData, let url = copyDataToTemporaryDirectory(fileData, file: file) { item.filePath = url - } else if let file = file, let url = file.fileLocation, url.scheme == "file" { + } else if let file = file, let url = file.resourceUrl, url.scheme == "file" { item.filePath = url } diff --git a/FileBrowser/PreviewTransitionViewController.swift b/FileBrowser/PreviewTransitionViewController.swift index a2c5e28..e7ee714 100644 --- a/FileBrowser/PreviewTransitionViewController.swift +++ b/FileBrowser/PreviewTransitionViewController.swift @@ -23,5 +23,15 @@ class PreviewTransitionViewController: UIViewController { quickLookPreviewController.view.frame = containerView.bounds quickLookPreviewController.didMove(toParentViewController: self) } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + self.hidesBottomBarWhenPushed = true + } + + override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + self.hidesBottomBarWhenPushed = true + } } diff --git a/FileBrowser/WebviewPreviewViewContoller.swift b/FileBrowser/WebviewPreviewViewContoller.swift index b4310bd..b916a2a 100644 --- a/FileBrowser/WebviewPreviewViewContoller.swift +++ b/FileBrowser/WebviewPreviewViewContoller.swift @@ -49,7 +49,7 @@ class WebviewPreviewViewContoller: UIViewController { let activityItems: [Any] if let data = fileData { activityItems = [data] - } else if let url = file.fileLocation { + } else if let url = file.resourceUrl { activityItems = [url] } else { return @@ -71,7 +71,7 @@ class WebviewPreviewViewContoller: UIViewController { let data: Data if let fileData = fileData { data = fileData - } else if let localFileUrl = file.fileLocation, + } else if let localFileUrl = file.resourceUrl, localFileUrl.scheme == "file", let fileData = try? Data(contentsOf: localFileUrl) { data = fileData diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index 82cede4..592629a 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -51,7 +51,7 @@ 48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = ""; }; 48A24C321D8C59250044C697 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../../../Library/Developer/Xcode/DerivedData/FileBrowserWorkspace-gvwbufuzyigeyaecovnmsyswnfyi/Build/Products/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3368F3C1E167B91003F4664 /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; - C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomDataSource.swift; sourceTree = ""; }; + C3BF0DFD1E13F5340009D12C /* CustomDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CustomDataSource.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C3BF0E051E1563F10009D12C /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; C3BF0E071E156BE60009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; C3BF0E0B1E15723A0009D12C /* FileBrowser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FileBrowser.framework; path = "../../build/Debug-iphoneos/FileBrowser.framework"; sourceTree = ""; }; diff --git a/examples/Sample/Sample/CustomDataSource.swift b/examples/Sample/Sample/CustomDataSource.swift index 1eb8046..1111ac3 100644 --- a/examples/Sample/Sample/CustomDataSource.swift +++ b/examples/Sample/Sample/CustomDataSource.swift @@ -25,7 +25,7 @@ open class CustomDataSource: FileBrowserDataSource { let rootUrl = URL(string: "/")! public var rootDirectory: FBFile { - let file = FBFile(path: rootUrl) + let file = BasicFBFile(path: rootUrl) file.displayName = "Home" return file } @@ -47,13 +47,13 @@ open class CustomDataSource: FileBrowserDataSource { guard let content = directoryDescription["content"] as? KeyValue else { throw JSONParsingError.noDirectoryContent } - let files = content.map {name, properties -> FBFile in + let files = content.map {name, properties -> BasicFBFile in let properties = properties as! KeyValue let isDirectory = (properties["type"] as? String) == "directory" let path = directory.path.appendingPathComponent(name, isDirectory: isDirectory) - let file = FBFile(path: path) + let file = BasicFBFile(path: path) if let resourceURLString = properties["location"] as? String, let resourceURL = URL(string: resourceURLString) { - file.fileLocation = resourceURL + file.resourceUrl = resourceURL } if let typeName = properties["type"] as? String, let type = FBFileType(rawValue: typeName) { file.type = type @@ -78,7 +78,7 @@ open class CustomDataSource: FileBrowserDataSource { public func dataURL(forFile file: FBFile) throws -> URL { - return file.fileLocation! + return file.resourceUrl! } }