From 9a66c3b355afd64ab2d095e74c5ff1878592ab52 Mon Sep 17 00:00:00 2001 From: Willy Breitenbach Date: Tue, 28 May 2019 14:55:12 +0200 Subject: [PATCH] updated for Swift 5 and Xcode 10.2 --- .gitignore | 1 + FileBrowser.podspec | 2 +- FileBrowser/FBFile.swift | 12 +-- FileBrowser/FileListSearch.swift | 4 +- FileBrowser/FileListTableView.swift | 6 +- .../PreviewTransitionViewController.swift | 4 +- examples/Sample/Podfile.lock | 16 ++++ .../Sample/Sample.xcodeproj/project.pbxproj | 81 +++++++++++++++++-- .../xcshareddata/xcschemes/Sample.xcscheme | 4 +- .../contents.xcworkspacedata | 10 +++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ .../Sample/Supporting Files/AppDelegate.swift | 2 +- .../View Controller/MainViewController.swift | 5 +- 13 files changed, 129 insertions(+), 26 deletions(-) create mode 100644 examples/Sample/Podfile.lock create mode 100644 examples/Sample/Sample.xcworkspace/contents.xcworkspacedata create mode 100644 examples/Sample/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.gitignore b/.gitignore index 4eec927..3b679b0 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ fastlane/screenshots .DS_Store examples/.DS_Store examples/Sample/.DS_Store +examples/Sample/Pods \ No newline at end of file diff --git a/FileBrowser.podspec b/FileBrowser.podspec index dc0f291..de93ae7 100644 --- a/FileBrowser.podspec +++ b/FileBrowser.podspec @@ -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' diff --git a/FileBrowser/FBFile.swift b/FileBrowser/FBFile.swift index ff3869d..6ca9006 100644 --- a/FileBrowser/FBFile.swift +++ b/FileBrowser/FBFile.swift @@ -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() { diff --git a/FileBrowser/FileListSearch.swift b/FileBrowser/FileListSearch.swift index ede8f3a..c808be2 100644 --- a/FileBrowser/FileListSearch.swift +++ b/FileBrowser/FileListSearch.swift @@ -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 diff --git a/FileBrowser/FileListTableView.swift b/FileBrowser/FileListTableView.swift index 2caba43..d4ff3ea 100644 --- a/FileBrowser/FileListTableView.swift +++ b/FileBrowser/FileListTableView.swift @@ -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) } } diff --git a/FileBrowser/PreviewTransitionViewController.swift b/FileBrowser/PreviewTransitionViewController.swift index a2c5e28..c314db4 100644 --- a/FileBrowser/PreviewTransitionViewController.swift +++ b/FileBrowser/PreviewTransitionViewController.swift @@ -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) } } diff --git a/examples/Sample/Podfile.lock b/examples/Sample/Podfile.lock new file mode 100644 index 0000000..67dee66 --- /dev/null +++ b/examples/Sample/Podfile.lock @@ -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 diff --git a/examples/Sample/Sample.xcodeproj/project.pbxproj b/examples/Sample/Sample.xcodeproj/project.pbxproj index c202da3..c2ec960 100644 --- a/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -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 */; }; @@ -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 = ""; }; + 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 = ""; }; 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 = ""; }; @@ -45,6 +48,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 = ""; }; + 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 */ @@ -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 = ""; + }; 48A199A41D8C53AC00C443D3 = { isa = PBXGroup; children = ( 48A199AF1D8C53AC00C443D3 /* Sample */, 48A199AE1D8C53AC00C443D3 /* Products */, 48A24C2F1D8C57390044C697 /* Frameworks */, + 353B0AB49DAA4D9D33420996 /* Pods */, ); sourceTree = ""; }; @@ -121,6 +136,7 @@ isa = PBXGroup; children = ( 48A24C321D8C59250044C697 /* FileBrowser.framework */, + C35C24B7C93096B20FDCCF78 /* Pods_Sample.framework */, ); name = Frameworks; sourceTree = ""; @@ -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 = ( ); @@ -158,7 +176,7 @@ TargetAttributes = { 48A199AC1D8C53AC00C443D3 = { CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; }; @@ -168,6 +186,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -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; @@ -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; @@ -333,7 +399,7 @@ 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; }; @@ -341,23 +407,27 @@ }; 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; @@ -369,6 +439,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme b/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme index d99945b..70f3dc2 100644 --- a/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme +++ b/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme @@ -1,6 +1,6 @@ @@ -46,7 +45,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" 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 @@ + + + + + + + diff --git a/examples/Sample/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/examples/Sample/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/examples/Sample/Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/examples/Sample/Sample/Supporting Files/AppDelegate.swift b/examples/Sample/Sample/Supporting Files/AppDelegate.swift index 5be52d3..5479e87 100644 --- a/examples/Sample/Sample/Supporting Files/AppDelegate.swift +++ b/examples/Sample/Sample/Supporting Files/AppDelegate.swift @@ -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() diff --git a/examples/Sample/Sample/View Controller/MainViewController.swift b/examples/Sample/Sample/View Controller/MainViewController.swift index c5594fe..22fe8f8 100644 --- a/examples/Sample/Sample/View Controller/MainViewController.swift +++ b/examples/Sample/Sample/View Controller/MainViewController.swift @@ -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) } }