Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b03284f584 | |||
| 5789117eb8 | |||
| 288eef2edd | |||
| 8eff0a225a | |||
| d7360bef22 | |||
| 23d56ec66a | |||
| 7e439ee9d8 | |||
| d7d7d106eb | |||
| ea1d7e4f89 | |||
| e410390531 | |||
| 5c6939aa3d | |||
| 399e1c093e | |||
| cbf1ce7874 | |||
| 659763f259 | |||
| 453c64808b | |||
| c8978ed444 | |||
| 40c72ba991 | |||
| f99535d27f | |||
| bd1f30a645 | |||
| 5ef3ca958a | |||
| dbf7644559 | |||
| c3360740ee | |||
| ccd3d4fc77 | |||
| 75fdcfcc46 | |||
| d47a2c9a70 |
@@ -61,3 +61,6 @@ Carthage/Build
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/screenshots
|
||||
.DS_Store
|
||||
examples/.DS_Store
|
||||
examples/Sample/.DS_Store
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
3.0
|
||||
4.0
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
osx_image: xcode8
|
||||
osx_image: xcode9
|
||||
language: objective-c
|
||||
env:
|
||||
global:
|
||||
|
||||
+2
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "FileBrowser"
|
||||
s.version = "0.2.0"
|
||||
s.version = "1.0.0"
|
||||
s.summary = "Powerful iOS file browser in Swift."
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
@@ -32,6 +32,7 @@ Pod::Spec.new do |s|
|
||||
|
||||
s.source_files = "FileBrowser"
|
||||
s.resources = "FileBrowser/Resources/*.*"
|
||||
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
|
||||
|
||||
# s.public_header_files = 'Pod/Classes/**/*.h'
|
||||
s.frameworks = 'QuickLook', 'WebKit'
|
||||
|
||||
@@ -254,16 +254,17 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0800;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = "Roy Marmelstein";
|
||||
TargetAttributes = {
|
||||
344169531C67812400B93D28 = {
|
||||
CreatedOnToolsVersion = 7.2.1;
|
||||
LastSwiftMigration = 0800;
|
||||
LastSwiftMigration = 0900;
|
||||
};
|
||||
3441695D1C67812400B93D28 = {
|
||||
CreatedOnToolsVersion = 7.2.1;
|
||||
LastSwiftMigration = 0800;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -358,20 +359,27 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 6;
|
||||
CURRENT_PROJECT_VERSION = 8;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -394,6 +402,7 @@
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -408,20 +417,27 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 6;
|
||||
CURRENT_PROJECT_VERSION = 8;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
@@ -437,6 +453,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
@@ -448,10 +465,9 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 6;
|
||||
DYLIB_CURRENT_VERSION = 8;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = FileBrowser/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
@@ -461,7 +477,6 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -469,10 +484,9 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 6;
|
||||
DYLIB_CURRENT_VERSION = 8;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = FileBrowser/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
@@ -481,29 +495,28 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.FileBrowser;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3441696C1C67812400B93D28 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEVELOPMENT_TEAM = "";
|
||||
INFOPLIST_FILE = FileBrowserTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.FileBrowserTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3441696D1C67812400B93D28 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEVELOPMENT_TEAM = "";
|
||||
INFOPLIST_FILE = FileBrowserTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.FileBrowserTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
@@ -55,6 +56,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3441695D1C67812400B93D28"
|
||||
BuildableName = "FileBrowserTests.xctest"
|
||||
BlueprintName = "FileBrowserTests"
|
||||
ReferencedContainer = "container:FileBrowser.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -9,9 +9,9 @@
|
||||
import Foundation
|
||||
|
||||
/// FBFile is a class representing a file in FileBrowser
|
||||
open class FBFile: NSObject {
|
||||
@objc open class FBFile: NSObject {
|
||||
/// Display name. String.
|
||||
open let displayName: String
|
||||
@objc open let displayName: String
|
||||
// is Directory. Bool.
|
||||
open let isDirectory: Bool
|
||||
/// File extension.
|
||||
@@ -23,6 +23,18 @@ open class FBFile: NSObject {
|
||||
// FBFileType
|
||||
open let type: FBFileType
|
||||
|
||||
open func delete()
|
||||
{
|
||||
do
|
||||
{
|
||||
try FileManager.default.removeItem(at: self.filePath)
|
||||
}
|
||||
catch
|
||||
{
|
||||
print("An error occured when trying to delete file:\(self.filePath) Error:\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize an FBFile object with a filePath
|
||||
|
||||
|
||||
@@ -35,30 +35,27 @@ open class FileBrowser: UINavigationController {
|
||||
fileList?.didSelectFile = didSelectFile
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Init to documents folder.
|
||||
|
||||
- returns: File browser view controller.
|
||||
*/
|
||||
|
||||
public convenience init() {
|
||||
let parser = FileParser.sharedInstance
|
||||
let path = parser.documentsURL()
|
||||
self.init(initialPath: path as URL)
|
||||
self.init(initialPath: path, allowEditing: true)
|
||||
}
|
||||
|
||||
/**
|
||||
Init to a custom directory path.
|
||||
|
||||
- parameter initialPath: NSURL filepath to containing directory.
|
||||
|
||||
- returns: File browser view controller.
|
||||
*/
|
||||
public convenience init(initialPath: URL) {
|
||||
let fileListViewController = FileListViewController(initialPath: initialPath)
|
||||
|
||||
/// Initialise file browser.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - initialPath: NSURL filepath to containing directory.
|
||||
/// - allowEditing: Whether to allow editing.
|
||||
/// - showCancelButton: Whether to show the cancel button.
|
||||
public convenience init(initialPath: URL? = nil, allowEditing: Bool = false, showCancelButton: Bool = true) {
|
||||
|
||||
let validInitialPath = initialPath ?? FileParser.sharedInstance.documentsURL()
|
||||
|
||||
let fileListViewController = FileListViewController(initialPath: validInitialPath, showCancelButton: showCancelButton)
|
||||
fileListViewController.allowEditing = allowEditing
|
||||
self.init(rootViewController: fileListViewController)
|
||||
self.view.backgroundColor = UIColor.white
|
||||
self.fileList = fileListViewController
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -86,5 +86,19 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
return collation.section(forSectionIndexTitle: index)
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
|
||||
if (editingStyle == UITableViewCellEditingStyle.delete) {
|
||||
let selectedFile = fileForIndexPath(indexPath)
|
||||
selectedFile.delete()
|
||||
|
||||
prepareData()
|
||||
tableView.reloadSections([indexPath.section], with: UITableViewRowAnimation.automatic)
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
||||
return allowEditing
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ class FileListViewController: UIViewController {
|
||||
let parser = FileParser.sharedInstance
|
||||
let previewManager = PreviewManager()
|
||||
var sections: [[FBFile]] = []
|
||||
var allowEditing: Bool = false
|
||||
|
||||
// Search controller
|
||||
var filteredFiles = [FBFile]()
|
||||
@@ -34,8 +35,11 @@ class FileListViewController: UIViewController {
|
||||
|
||||
|
||||
//MARK: Lifecycle
|
||||
|
||||
convenience init (initialPath: URL) {
|
||||
self.init(initialPath: initialPath, showCancelButton: true)
|
||||
}
|
||||
|
||||
convenience init (initialPath: URL, showCancelButton: Bool) {
|
||||
self.init(nibName: "FileBrowser", bundle: Bundle(for: FileListViewController.self))
|
||||
self.edgesForExtendedLayout = UIRectEdge()
|
||||
|
||||
@@ -48,10 +52,11 @@ class FileListViewController: UIViewController {
|
||||
searchController.searchBar.delegate = self
|
||||
searchController.delegate = self
|
||||
|
||||
// Add dismiss button
|
||||
let dismissButton = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(FileListViewController.dismiss(button:)))
|
||||
self.navigationItem.rightBarButtonItem = dismissButton
|
||||
|
||||
if showCancelButton {
|
||||
// Add dismiss button
|
||||
let dismissButton = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(FileListViewController.dismiss(button:)))
|
||||
self.navigationItem.rightBarButtonItem = dismissButton
|
||||
}
|
||||
}
|
||||
|
||||
deinit{
|
||||
@@ -62,15 +67,19 @@ class FileListViewController: UIViewController {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: UIViewController
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
||||
func prepareData() {
|
||||
// Prepare data
|
||||
if let initialPath = initialPath {
|
||||
files = parser.filesForDirectory(initialPath)
|
||||
indexFiles()
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: UIViewController
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
||||
prepareData()
|
||||
|
||||
// Set search bar
|
||||
tableView.tableHeaderView = searchController.searchBar
|
||||
@@ -96,7 +105,7 @@ class FileListViewController: UIViewController {
|
||||
//MARK: Data
|
||||
|
||||
func indexFiles() {
|
||||
let selector: Selector = #selector(getter: UIPrinter.displayName)
|
||||
let selector: Selector = #selector(getter: FBFile.displayName)
|
||||
sections = Array(repeating: [], count: collation.sectionTitles.count)
|
||||
if let sortedObjects = collation.sortedArray(from: files, collationStringSelector: selector) as? [FBFile]{
|
||||
for object in sortedObjects {
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.2.0</string>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>6</string>
|
||||
<string>8</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
|
||||
@@ -28,7 +28,7 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
self.view.addSubview(webView)
|
||||
|
||||
// Add share button
|
||||
let shareButton = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(WebviewPreviewViewContoller.shareFile))
|
||||
let shareButton = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(WebviewPreviewViewContoller.shareFile(_:)))
|
||||
self.navigationItem.rightBarButtonItem = shareButton
|
||||
}
|
||||
|
||||
@@ -39,13 +39,18 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
|
||||
//MARK: Share
|
||||
|
||||
func shareFile() {
|
||||
@objc func shareFile(_ sender: UIBarButtonItem) {
|
||||
guard let file = file else {
|
||||
return
|
||||
}
|
||||
let activityViewController = UIActivityViewController(activityItems: [file.filePath], applicationActivities: nil)
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom == .pad &&
|
||||
activityViewController.responds(to: #selector(getter: popoverPresentationController)) {
|
||||
activityViewController.popoverPresentationController?.barButtonItem = sender
|
||||
}
|
||||
|
||||
self.present(activityViewController, animated: true, completion: nil)
|
||||
|
||||
}
|
||||
|
||||
//MARK: Processing
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.2.0</string>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>6</string>
|
||||
<string>8</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:examples/Sample/Sample.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:FileBrowser.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,69 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (4.2.7.1)
|
||||
i18n (~> 0.7)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
claide (1.0.0)
|
||||
cocoapods (1.1.0.rc.1)
|
||||
activesupport (>= 4.0.2, < 5)
|
||||
claide (>= 1.0.0, < 2.0)
|
||||
cocoapods-core (= 1.1.0.rc.1)
|
||||
cocoapods-deintegrate (>= 1.0.1, < 2.0)
|
||||
cocoapods-downloader (>= 1.1.1, < 2.0)
|
||||
cocoapods-plugins (>= 1.0.0, < 2.0)
|
||||
cocoapods-search (>= 1.0.0, < 2.0)
|
||||
cocoapods-stats (>= 1.0.0, < 2.0)
|
||||
cocoapods-trunk (>= 1.0.0, < 2.0)
|
||||
cocoapods-try (>= 1.1.0, < 2.0)
|
||||
colored (~> 1.2)
|
||||
escape (~> 0.0.4)
|
||||
fourflusher (~> 1.0.1)
|
||||
gh_inspector (~> 1.0)
|
||||
molinillo (~> 0.5.0)
|
||||
nap (~> 1.0)
|
||||
xcodeproj (>= 1.3.1, < 2.0)
|
||||
cocoapods-core (1.1.0.rc.1)
|
||||
activesupport (>= 4.0.2, < 5)
|
||||
fuzzy_match (~> 2.0.4)
|
||||
nap (~> 1.0)
|
||||
cocoapods-deintegrate (1.0.1)
|
||||
cocoapods-downloader (1.1.1)
|
||||
cocoapods-plugins (1.0.0)
|
||||
nap
|
||||
cocoapods-search (1.0.0)
|
||||
cocoapods-stats (1.0.0)
|
||||
cocoapods-trunk (1.0.0)
|
||||
nap (>= 0.8, < 2.0)
|
||||
netrc (= 0.7.8)
|
||||
cocoapods-try (1.1.0)
|
||||
colored (1.2)
|
||||
escape (0.0.4)
|
||||
fourflusher (1.0.1)
|
||||
fuzzy_match (2.0.4)
|
||||
gh_inspector (1.0.2)
|
||||
i18n (0.7.0)
|
||||
json (1.8.3)
|
||||
minitest (5.9.0)
|
||||
molinillo (0.5.0)
|
||||
nap (1.1.0)
|
||||
netrc (0.7.8)
|
||||
thread_safe (0.3.5)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
xcodeproj (1.3.1)
|
||||
activesupport (>= 3)
|
||||
claide (>= 1.0.0, < 2.0)
|
||||
colored (~> 1.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
cocoapods (= 1.1.0.rc.1)
|
||||
|
||||
BUNDLED WITH
|
||||
1.12.5
|
||||
@@ -4,22 +4,22 @@
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
|
||||
# FileBrowser
|
||||
iOS Finder-style file browser in Swift with search, file previews and 3D touch. Simple and quick to use.
|
||||
iOS Finder-style file browser in Swift 4.0 with search, file previews and 3D touch. Simple and quick to use.
|
||||
|
||||
<p align="center"><img src="http://i.giphy.com/3o6gaY6yLQkhjiok5W.gif" width="242" height="425"/></p>
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
| Features
|
||||
--------------------------|------------------------------------------------------------
|
||||
:sparkles: | Features
|
||||
--------------------------|----------------------------
|
||||
:iphone: | Browse and select files and folders with a familiar UI on iOS.
|
||||
:mag: | Pull down to search.
|
||||
:eyeglasses: | Preview most file types. Including plist and json.
|
||||
:pencil: | Edit/delete files.
|
||||
:point_up_2: | 3D touch support for faster previews with Peek & Pop.
|
||||
:white_flower: | Fully customizable.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Import FileBrowser at the top of the Swift file.
|
||||
@@ -31,7 +31,7 @@ import FileBrowser
|
||||
To show the file browser, all you need to do is:
|
||||
```swift
|
||||
let fileBrowser = FileBrowser()
|
||||
present(file, animated: true, completion: nil)
|
||||
present(fileBrowser, animated: true, completion: nil)
|
||||
```
|
||||
|
||||
By default, the file browser will open in your app's documents directory. When users select a file, a preview will be displayed - offering an action sheet of options based on the file type.
|
||||
@@ -43,6 +43,11 @@ You can open FileBrowser in a different root folder by initialising with an NSUR
|
||||
let fileBrowser = FileBrowser(initialPath: customPath)
|
||||
```
|
||||
|
||||
You can also allow editing/deleting files.
|
||||
```swift
|
||||
let fileBrowser = FileBrowser(initialPath: customPath, allowEditing: true)
|
||||
```
|
||||
|
||||
Use the didSelectFile closure to change FileBrowser's behaviour when a file is selected.
|
||||
```swift
|
||||
fileBrowser.didSelectFile = { (file: FBFile) -> Void in
|
||||
@@ -59,7 +64,7 @@ fileBrowser.excludesFilepaths = [secretFile]
|
||||
### Setting up with [CocoaPods](http://cocoapods.org/?q=FileBrowser)
|
||||
```ruby
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
pod 'FileBrowser', '~> 0.2'
|
||||
pod 'FileBrowser', '~> 1.0'
|
||||
```
|
||||
|
||||
### Setting up with Carthage
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# **** Update me when new Xcode versions are released! ****
|
||||
PLATFORM="platform=iOS Simulator,OS=10.0,name=iPhone 7"
|
||||
SDK="iphonesimulator10.0"
|
||||
PLATFORM="platform=iOS Simulator,OS=11.0,name=iPhone 8"
|
||||
SDK="iphonesimulator"
|
||||
|
||||
|
||||
# It is pitch black.
|
||||
@@ -40,7 +40,7 @@ if [ "$MODE" = "examples" ]; then
|
||||
-scheme Sample \
|
||||
-sdk "$SDK" \
|
||||
-destination "$PLATFORM" \
|
||||
build test
|
||||
build
|
||||
done
|
||||
trap - EXIT
|
||||
exit 0
|
||||
|
||||
@@ -153,14 +153,13 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0800;
|
||||
LastUpgradeCheck = 0800;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = "Mihail Șalari";
|
||||
TargetAttributes = {
|
||||
48A199AC1D8C53AC00C443D3 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
DevelopmentTeam = U82TG7992X;
|
||||
LastSwiftMigration = 0800;
|
||||
ProvisioningStyle = Automatic;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -240,7 +239,9 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@@ -248,7 +249,12 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -277,6 +283,7 @@
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -290,7 +297,9 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@@ -298,7 +307,12 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -319,6 +333,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@@ -330,14 +345,14 @@
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
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";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mihailsalari.Sample;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -347,13 +362,13 @@
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
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";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mihailsalari.Sample;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "48A199AC1D8C53AC00C443D3"
|
||||
BuildableName = "Sample.app"
|
||||
BlueprintName = "Sample"
|
||||
ReferencedContainer = "container:Sample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "48A199AC1D8C53AC00C443D3"
|
||||
BuildableName = "Sample.app"
|
||||
BlueprintName = "Sample"
|
||||
ReferencedContainer = "container:Sample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "48A199AC1D8C53AC00C443D3"
|
||||
BuildableName = "Sample.app"
|
||||
BlueprintName = "Sample"
|
||||
ReferencedContainer = "container:Sample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "48A199AC1D8C53AC00C443D3"
|
||||
BuildableName = "Sample.app"
|
||||
BlueprintName = "Sample"
|
||||
ReferencedContainer = "container:Sample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,5 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
@@ -30,6 +40,16 @@
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
@@ -59,6 +79,11 @@
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
Reference in New Issue
Block a user