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

updated for Swift 5 and Xcode 10.2 #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ fastlane/screenshots
.DS_Store
examples/.DS_Store
examples/Sample/.DS_Store
examples/Sample/Pods
2 changes: 1 addition & 1 deletion FileBrowser.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Pod::Spec.new do |s|

s.source_files = "FileBrowser"
s.resources = "FileBrowser/Resources/*.*"
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '5.0' }

# s.public_header_files = 'Pod/Classes/**/*.h'
s.frameworks = 'QuickLook', 'WebKit'
Expand Down
12 changes: 6 additions & 6 deletions FileBrowser/FBFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import Foundation
/// FBFile is a class representing a file in FileBrowser
@objc open class FBFile: NSObject {
/// Display name. String.
@objc open let displayName: String
@objc public let displayName: String
// is Directory. Bool.
open let isDirectory: Bool
public let isDirectory: Bool
/// File extension.
open let fileExtension: String?
public let fileExtension: String?
/// File attributes (including size, creation date etc).
open let fileAttributes: NSDictionary?
public let fileAttributes: NSDictionary?
/// NSURL file path.
open let filePath: URL
public let filePath: URL
// FBFileType
open let type: FBFileType
public let type: FBFileType

open func delete()
{
Expand Down
4 changes: 2 additions & 2 deletions FileBrowser/FileListSearch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ extension FileListViewController: UISearchBarDelegate, UISearchControllerDelegat

// MARK: UISearchControllerDelegate
func willPresentSearchController(_ searchController: UISearchController) {
self.tableView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0)
self.tableView.contentInset = UIEdgeInsets.init(top: 20, left: 0, bottom: 0, right: 0)
}

func willDismissSearchController(_ searchController: UISearchController) {
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0)
self.tableView.contentInset = UIEdgeInsets.init(top: 0, left: 0, bottom: 0, right: 0)
}

// MARK: UISearchBarDelegate
Expand Down
6 changes: 3 additions & 3 deletions FileBrowser/FileListTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate {
return collation.section(forSectionIndexTitle: index)
}

func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if (editingStyle == UITableViewCellEditingStyle.delete) {
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if (editingStyle == UITableViewCell.EditingStyle.delete) {
let selectedFile = fileForIndexPath(indexPath)
selectedFile.delete()

prepareData()
tableView.reloadSections([indexPath.section], with: UITableViewRowAnimation.automatic)
tableView.reloadSections([indexPath.section], with: UITableView.RowAnimation.automatic)
}
}

Expand Down
4 changes: 2 additions & 2 deletions FileBrowser/PreviewTransitionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class PreviewTransitionViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
self.addChildViewController(quickLookPreviewController)
self.addChild(quickLookPreviewController)
containerView.addSubview(quickLookPreviewController.view)
quickLookPreviewController.view.frame = containerView.bounds
quickLookPreviewController.didMove(toParentViewController: self)
quickLookPreviewController.didMove(toParent: self)
}

}
16 changes: 16 additions & 0 deletions examples/Sample/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PODS:
- FileBrowser (1.0.0)

DEPENDENCIES:
- FileBrowser (from `../..`)

EXTERNAL SOURCES:
FileBrowser:
:path: "../.."

SPEC CHECKSUMS:
FileBrowser: 8c2f7e00ef20316b2a84c3107890baab6ab7819c

PODFILE CHECKSUM: aaefb425330b5b14baa22345634307ee30f2826a

COCOAPODS: 1.6.1
81 changes: 76 additions & 5 deletions examples/Sample/Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
28107142E1C0DC9EE4690ED9 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C35C24B7C93096B20FDCCF78 /* Pods_Sample.framework */; };
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 */; };
Expand All @@ -33,6 +34,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
18F94778EEAD7B729734E78D /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = "<group>"; };
1E3E96AC263D87B335B88EC8 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = "<group>"; };
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 = "<group>"; };
48A199B71D8C53AC00C443D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand All @@ -45,6 +48,7 @@
48A199CB1D8C546000C443D3 /* Images.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Images.zip; sourceTree = "<group>"; };
48A199CC1D8C546000C443D3 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = "<group>"; };
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 = "<group>"; };
C35C24B7C93096B20FDCCF78 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -53,18 +57,29 @@
buildActionMask = 2147483647;
files = (
48A24C331D8C59250044C697 /* FileBrowser.framework in Frameworks */,
28107142E1C0DC9EE4690ED9 /* Pods_Sample.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
353B0AB49DAA4D9D33420996 /* Pods */ = {
isa = PBXGroup;
children = (
18F94778EEAD7B729734E78D /* Pods-Sample.debug.xcconfig */,
1E3E96AC263D87B335B88EC8 /* Pods-Sample.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
48A199A41D8C53AC00C443D3 = {
isa = PBXGroup;
children = (
48A199AF1D8C53AC00C443D3 /* Sample */,
48A199AE1D8C53AC00C443D3 /* Products */,
48A24C2F1D8C57390044C697 /* Frameworks */,
353B0AB49DAA4D9D33420996 /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -121,6 +136,7 @@
isa = PBXGroup;
children = (
48A24C321D8C59250044C697 /* FileBrowser.framework */,
C35C24B7C93096B20FDCCF78 /* Pods_Sample.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -132,10 +148,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */;
buildPhases = (
6271BE98B07FAD649BCC18ED /* [CP] Check Pods Manifest.lock */,
48A199A91D8C53AC00C443D3 /* Sources */,
48A199AA1D8C53AC00C443D3 /* Frameworks */,
48A199AB1D8C53AC00C443D3 /* Resources */,
48A199DD1D8C564100C443D3 /* Embed Frameworks */,
FC94115770A1A92C3C9E1B3A /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -158,7 +176,7 @@
TargetAttributes = {
48A199AC1D8C53AC00C443D3 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual;
};
};
Expand All @@ -168,6 +186,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -198,6 +217,53 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
6271BE98B07FAD649BCC18ED /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt",
);
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# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
FC94115770A1A92C3C9E1B3A /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/FileBrowser/FileBrowser.framework",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FileBrowser.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
48A199A91D8C53AC00C443D3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -283,7 +349,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -333,31 +399,35 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
48A199C01D8C53AC00C443D3 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 18F94778EEAD7B729734E78D /* Pods-Sample.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "iPhone Distribution";
DEVELOPMENT_TEAM = 6CMHTT5AKC;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "$(SRCROOT)/Sample/Supporting Files/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
PROVISIONING_PROFILE_SPECIFIER = "XC iOS: *";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
48A199C11D8C53AC00C443D3 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1E3E96AC263D87B335B88EC8 /* Pods-Sample.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
Expand All @@ -369,6 +439,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -46,7 +45,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
10 changes: 10 additions & 0 deletions examples/Sample/Sample.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion examples/Sample/Sample/Supporting Files/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

self.populateTableViewWithFiles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ class MainViewController: UIViewController {
// MARK: - FileBrowser

@IBAction func showFileBrowser(sender: AnyObject) {
let file = FileBrowser()
present(file, animated: true, completion: nil)
//self.present(fileBrowser, animated: true, completion: nil)
let fileBrowser = FileBrowser()
present(fileBrowser, animated: true, completion: nil)
}
}