Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom file systems and remote files #24

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
42f0f61
Add dataSource protocol to allow using custom file systems
MasterCarl Dec 28, 2016
72e8559
Add sample custom file browser
MasterCarl Dec 28, 2016
133c910
Fix tests
MasterCarl Dec 28, 2016
a06cf13
Remove development team from build settings
MasterCarl Dec 28, 2016
b4d6b0e
Replace URLs with FBFiles as directory descriptors
MasterCarl Dec 29, 2016
0667978
Add AlamoFire pod
MasterCarl Dec 29, 2016
7c45c12
Update .gitignore to exclude pods
MasterCarl Dec 29, 2016
6added5
Add and integrate LoadingViewController, numerous other changes
MasterCarl Dec 29, 2016
0124669
Change Sample CustomDataSource to use JSON file, adapt to changes
MasterCarl Dec 29, 2016
af93f76
Fix tests
MasterCarl Dec 29, 2016
2d25a80
Fix pods issues
MasterCarl Dec 30, 2016
47a8b89
Update travis.yml to install main pods
MasterCarl Dec 30, 2016
de480d7
Add spec source to Podfile
MasterCarl Dec 30, 2016
4780a34
Add pod repo update to .travis.yml
MasterCarl Dec 30, 2016
2c7c00a
Use sepatate workspace for sample app
MasterCarl Dec 30, 2016
354cc50
Update pods
MasterCarl Dec 30, 2016
31c1a91
Fix build settings
MasterCarl Dec 30, 2016
e7e09c3
Implement asynchronous loading of directory content
MasterCarl Jan 1, 2017
76a5823
Add Result enum for callbacks
MasterCarl Jan 1, 2017
41560d5
Remove activity indicator in FileList
MasterCarl Jan 2, 2017
cfd5b7a
Replace AlamoFire with URLSession
MasterCarl Jan 8, 2017
871d56f
Undo changes made to include pod dependencies
MasterCarl Jan 22, 2017
54c0fdc
Show errors during directory content loading
MasterCarl Jan 22, 2017
c2c0c26
Adapt and fix tests
MasterCarl Jan 22, 2017
c596583
Provide an example for a folder that fails to load
MasterCarl Jan 22, 2017
7d783bd
Add a loading indicator for folders
MasterCarl Jan 22, 2017
186ec60
Show downloading errors, remove unnecessary URLSession functions
MasterCarl Jan 22, 2017
f8d6849
Fix WebView not displaying files
MasterCarl Jan 23, 2017
0fb0517
Remove option to exclude files with empty filenames
MasterCarl Jan 23, 2017
4f9bcdf
Fix build settings
MasterCarl May 8, 2017
4aaaf83
Fix SWIFT_VERSION being unset in examples
MasterCarl May 8, 2017
adee3ec
Rename Result to FBResult to avoid namespace collisions
MasterCarl May 9, 2017
7b901c2
Remove unnecessary optional cast
MasterCarl May 9, 2017
4452e85
Improve handling of remote files and download customization
MasterCarl May 11, 2017
afa9126
Update build settings
MasterCarl May 11, 2017
51ef5d2
Make FBFile a protocol, change fileLocation to resourceUrl
MasterCarl May 11, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
48 changes: 37 additions & 11 deletions FileBrowser.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
349A12361C707E86005435C0 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 349A122F1C707E86005435C0 /* [email protected] */; };
349A12371C707E86005435C0 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 349A12301C707E86005435C0 /* [email protected] */; };
349A12381C707E86005435C0 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 349A12311C707E86005435C0 /* [email protected] */; };
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 /* 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 */; };
C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */; };
C3C2AC201EC25F470060AECA /* FileBrowserDownloadDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -46,15 +55,15 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListViewController.swift; sourceTree = "<group>"; };
3437405A1C6E7DA50090FD6A /* FileListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListViewController.swift; sourceTree = "<group>"; };
3439AB671C6F203A0058AF04 /* FileParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileParser.swift; sourceTree = "<group>"; };
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 = "<group>"; };
3439AB6F1C6FF68C0058AF04 /* FileBrowser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowser.swift; sourceTree = "<group>"; };
3439AB6F1C6FF68C0058AF04 /* FileBrowser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileBrowser.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
343C44611C73CC8100D874FB /* PreviewTransitionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewTransitionViewController.swift; sourceTree = "<group>"; };
343C44651C73CD3200D874FB /* PreviewManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewManager.swift; sourceTree = "<group>"; };
343C44651C73CD3200D874FB /* PreviewManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = PreviewManager.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
343C44671C73CD8700D874FB /* PreviewTransitionViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreviewTransitionViewController.xib; sourceTree = "<group>"; };
343C44781C73CFC400D874FB /* WebviewPreviewViewContoller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebviewPreviewViewContoller.swift; sourceTree = "<group>"; };
343C44781C73CFC400D874FB /* WebviewPreviewViewContoller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = WebviewPreviewViewContoller.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
343C447C1C73CFD900D874FB /* WebviewPreviewViewContoller.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WebviewPreviewViewContoller.xib; sourceTree = "<group>"; };
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; };
Expand All @@ -66,15 +75,20 @@
3441DC601C71235C005CC2FA /* 3crBXeO.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = 3crBXeO.gif; sourceTree = "<group>"; };
3441DC621C712370005CC2FA /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = "<group>"; };
349A12231C70725D005435C0 /* FileListSearch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListSearch.swift; sourceTree = "<group>"; };
349A12251C707317005435C0 /* FileListTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileListTableView.swift; sourceTree = "<group>"; };
349A12271C707B1A005435C0 /* FBFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FBFile.swift; sourceTree = "<group>"; };
349A12251C707317005435C0 /* FileListTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileListTableView.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
349A12271C707B1A005435C0 /* FBFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FBFile.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
349A122B1C707E86005435C0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
349A122C1C707E86005435C0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
349A122D1C707E86005435C0 /* FileBrowser.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FileBrowser.xib; sourceTree = "<group>"; };
349A122E1C707E86005435C0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
349A122F1C707E86005435C0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
349A12301C707E86005435C0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
349A12311C707E86005435C0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
C3308C8E1E3501BE00F4D125 /* FBResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FBResult.swift; sourceTree = "<group>"; };
C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileBrowserDataSource.swift; sourceTree = "<group>"; };
C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingViewController.xib; sourceTree = "<group>"; };
C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = LoadingViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FileBrowserDownloadDelegate.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -103,6 +117,9 @@
children = (
3439AB671C6F203A0058AF04 /* FileParser.swift */,
349A12271C707B1A005435C0 /* FBFile.swift */,
C3BF0DFB1E13F4A80009D12C /* FileBrowserDataSource.swift */,
C3308C8E1E3501BE00F4D125 /* FBResult.swift */,
C3C2AC1D1EC25A6F0060AECA /* FileBrowserDownloadDelegate.swift */,
);
name = Data;
sourceTree = "<group>";
Expand All @@ -121,6 +138,7 @@
343C44601C73CC3C00D874FB /* Preview */ = {
isa = PBXGroup;
children = (
C3BF0E011E153A2C0009D12C /* LoadingViewController.swift */,
343C44611C73CC8100D874FB /* PreviewTransitionViewController.swift */,
343C44651C73CD3200D874FB /* PreviewManager.swift */,
343C44781C73CFC400D874FB /* WebviewPreviewViewContoller.swift */,
Expand Down Expand Up @@ -187,6 +205,7 @@
349A122B1C707E86005435C0 /* [email protected] */,
349A122C1C707E86005435C0 /* [email protected] */,
349A122D1C707E86005435C0 /* FileBrowser.xib */,
C3BF0DFF1E1534070009D12C /* LoadingViewController.xib */,
349A122E1C707E86005435C0 /* [email protected] */,
349A122F1C707E86005435C0 /* [email protected] */,
349A12301C707E86005435C0 /* [email protected] */,
Expand Down Expand Up @@ -294,6 +313,7 @@
343C44681C73CD8700D874FB /* PreviewTransitionViewController.xib in Resources */,
349A12331C707E86005435C0 /* [email protected] in Resources */,
349A12341C707E86005435C0 /* FileBrowser.xib in Resources */,
C3BF0E001E1534070009D12C /* LoadingViewController.xib in Resources */,
343C447D1C73CFD900D874FB /* WebviewPreviewViewContoller.xib in Resources */,
349A12361C707E86005435C0 /* [email protected] in Resources */,
349A12371C707E86005435C0 /* [email protected] in Resources */,
Expand All @@ -319,23 +339,31 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
349A12281C707B1A005435C0 /* FBFile.swift in Sources */,
C3C2AC201EC25F470060AECA /* FileBrowserDownloadDelegate.swift in Sources */,
343C447A1C73CFC400D874FB /* WebviewPreviewViewContoller.swift 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 */,
349A12241C70725D005435C0 /* FileListSearch.swift in Sources */,
3439AB6C1C6FD6650058AF04 /* FileListPreview.swift in Sources */,
C3BF0E021E153A2C0009D12C /* LoadingViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3441695A1C67812400B93D28 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C3308C901E351F9D00F4D125 /* FileParser.swift in Sources */,
C3308C911E351FB500F4D125 /* FBFile.swift in Sources */,
C3308C921E351FCF00F4D125 /* FBResult.swift in Sources */,
C3308C931E351FE900F4D125 /* FileBrowserDataSource.swift in Sources */,
344169641C67812400B93D28 /* FileBrowserTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -370,8 +398,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;
Expand Down Expand Up @@ -421,8 +447,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";
Expand Down Expand Up @@ -455,6 +479,7 @@
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;
Expand All @@ -475,6 +500,7 @@
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;
Expand Down
75 changes: 45 additions & 30 deletions FileBrowser/FBFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,38 @@
//

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 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?
/// NSURL file path.
open let filePath: URL

open var resourceUrl: URL?
// FBFileType
open let type: FBFileType
open var type: FBFileType


open let path: URL

/**
Initialize an FBFile object with a filePath
Expand All @@ -30,26 +47,31 @@ open class FBFile: NSObject {

- returns: FBFile object.
*/
init(filePath: URL) {
self.filePath = filePath
let isDirectory = checkDirectory(filePath)
self.isDirectory = isDirectory
public init(path: URL) {
self.path = path
self.isDirectory = checkDirectory(path)

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
}
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 {
guard let resourceUrl = resourceUrl else {
return true
}
return resourceUrl.scheme == "http" || resourceUrl.scheme == "https"
}
}

Expand Down Expand Up @@ -82,7 +104,7 @@ public enum FBFileType: String {
- returns: UIImage for file type
*/
public func image() -> UIImage? {
let bundle = Bundle(for: FileParser.self)
let bundle = Bundle(for: FileBrowser.self)
var fileName = String()
switch self {
case .Directory: fileName = "[email protected]"
Expand All @@ -104,6 +126,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?
Expand All @@ -115,13 +140,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
}
14 changes: 14 additions & 0 deletions FileBrowser/FBResult.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// FBResult.swift
// FileBrowser
//
// Created by Carl Julius Gödecken on 01/01/2017.
// Copyright © 2017 Carl Julius Gödecken.
//

import Foundation

public enum FBResult<T> {
case success(T)
case error(Error)
}
Loading