Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7fae9fa2df | |||
| 8798ba3a29 | |||
| cfe4dafe14 | |||
| 057ac3aaed | |||
| 2d505e2401 | |||
| ca26cfc5c1 | |||
| aca8f7a50e | |||
| ac3c3daefb | |||
| f379913f1d | |||
| f95bac9ee5 | |||
| ed5a54b19f |
@@ -0,0 +1 @@
|
||||
3.0
|
||||
+2
-4
@@ -1,13 +1,11 @@
|
||||
osx_image: xcode7.3
|
||||
osx_image: xcode8
|
||||
language: objective-c
|
||||
env:
|
||||
global:
|
||||
- LC_CTYPE=en_US.UTF-8
|
||||
- LANG=en_US.UTF-8
|
||||
before_install:
|
||||
- brew update || brew update
|
||||
- brew outdated xctool || brew upgrade xctool
|
||||
- gem install cocoapods
|
||||
- gem install cocoapods --pre
|
||||
- xcrun simctl list
|
||||
install: echo "<3"
|
||||
env:
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "FileBrowser"
|
||||
s.version = "0.1.4"
|
||||
s.version = "0.2.0"
|
||||
s.summary = "Powerful iOS file browser in Swift."
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
|
||||
@@ -254,14 +254,16 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0720;
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = "Roy Marmelstein";
|
||||
TargetAttributes = {
|
||||
344169531C67812400B93D28 = {
|
||||
CreatedOnToolsVersion = 7.2.1;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
3441695D1C67812400B93D28 = {
|
||||
CreatedOnToolsVersion = 7.2.1;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -361,13 +363,15 @@
|
||||
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_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 5;
|
||||
CURRENT_PROJECT_VERSION = 6;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -385,7 +389,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -409,13 +413,15 @@
|
||||
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_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 5;
|
||||
CURRENT_PROJECT_VERSION = 6;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
@@ -427,9 +433,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
@@ -441,9 +448,10 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 5;
|
||||
DYLIB_CURRENT_VERSION = 6;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = FileBrowser/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
@@ -453,6 +461,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -460,9 +469,10 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 5;
|
||||
DYLIB_CURRENT_VERSION = 6;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = FileBrowser/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
@@ -471,6 +481,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.FileBrowser;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -481,6 +492,7 @@
|
||||
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;
|
||||
};
|
||||
@@ -491,6 +503,7 @@
|
||||
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 = "0720"
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
+21
-23
@@ -9,19 +9,19 @@
|
||||
import Foundation
|
||||
|
||||
/// FBFile is a class representing a file in FileBrowser
|
||||
public class FBFile: NSObject {
|
||||
open class FBFile: NSObject {
|
||||
/// Display name. String.
|
||||
public let displayName: String
|
||||
open let displayName: String
|
||||
// is Directory. Bool.
|
||||
public let isDirectory: Bool
|
||||
open let isDirectory: Bool
|
||||
/// File extension.
|
||||
public let fileExtension: String?
|
||||
open let fileExtension: String?
|
||||
/// File attributes (including size, creation date etc).
|
||||
public let fileAttributes: NSDictionary?
|
||||
open let fileAttributes: NSDictionary?
|
||||
/// NSURL file path.
|
||||
public let filePath: NSURL
|
||||
open let filePath: URL
|
||||
// FBFileType
|
||||
public let type: FBFileType
|
||||
open let type: FBFileType
|
||||
|
||||
/**
|
||||
Initialize an FBFile object with a filePath
|
||||
@@ -30,7 +30,7 @@ public class FBFile: NSObject {
|
||||
|
||||
- returns: FBFile object.
|
||||
*/
|
||||
init(filePath: NSURL) {
|
||||
init(filePath: URL) {
|
||||
self.filePath = filePath
|
||||
let isDirectory = checkDirectory(filePath)
|
||||
self.isDirectory = isDirectory
|
||||
@@ -49,7 +49,7 @@ public class FBFile: NSObject {
|
||||
self.type = .Default
|
||||
}
|
||||
}
|
||||
self.displayName = filePath.lastPathComponent ?? String()
|
||||
self.displayName = filePath.lastPathComponent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,16 +82,16 @@ public enum FBFileType: String {
|
||||
- returns: UIImage for file type
|
||||
*/
|
||||
public func image() -> UIImage? {
|
||||
let bundle = NSBundle(forClass: FileParser.self)
|
||||
let bundle = Bundle(for: FileParser.self)
|
||||
var fileName = String()
|
||||
switch self {
|
||||
case Directory: fileName = "folder@2x.png"
|
||||
case JPG, PNG, GIF: fileName = "image@2x.png"
|
||||
case PDF: fileName = "pdf@2x.png"
|
||||
case ZIP: fileName = "zip@2x.png"
|
||||
case .Directory: fileName = "folder@2x.png"
|
||||
case .JPG, .PNG, .GIF: fileName = "image@2x.png"
|
||||
case .PDF: fileName = "pdf@2x.png"
|
||||
case .ZIP: fileName = "zip@2x.png"
|
||||
default: fileName = "file@2x.png"
|
||||
}
|
||||
let file = UIImage(named: fileName, inBundle: bundle, compatibleWithTraitCollection: nil)
|
||||
let file = UIImage(named: fileName, in: bundle, compatibleWith: nil)
|
||||
return file
|
||||
}
|
||||
}
|
||||
@@ -103,12 +103,12 @@ public enum FBFileType: String {
|
||||
|
||||
- returns: isDirectory Bool.
|
||||
*/
|
||||
func checkDirectory(filePath: NSURL) -> Bool {
|
||||
func checkDirectory(_ filePath: URL) -> Bool {
|
||||
var isDirectory = false
|
||||
do {
|
||||
var resourceValue: AnyObject?
|
||||
try filePath.getResourceValue(&resourceValue, forKey: NSURLIsDirectoryKey)
|
||||
if let number = resourceValue as? NSNumber where number == true {
|
||||
try (filePath as NSURL).getResourceValue(&resourceValue, forKey: URLResourceKey.isDirectoryKey)
|
||||
if let number = resourceValue as? NSNumber , number == true {
|
||||
isDirectory = true
|
||||
}
|
||||
}
|
||||
@@ -116,13 +116,11 @@ func checkDirectory(filePath: NSURL) -> Bool {
|
||||
return isDirectory
|
||||
}
|
||||
|
||||
func getFileAttributes(filePath: NSURL) -> NSDictionary? {
|
||||
guard let path = filePath.path else {
|
||||
return nil
|
||||
}
|
||||
func getFileAttributes(_ filePath: URL) -> NSDictionary? {
|
||||
let path = filePath.path
|
||||
let fileManager = FileParser.sharedInstance.fileManager
|
||||
do {
|
||||
let attributes = try fileManager.attributesOfItemAtPath(path) as NSDictionary
|
||||
let attributes = try fileManager.attributesOfItem(atPath: path) as NSDictionary
|
||||
return attributes
|
||||
} catch {}
|
||||
return nil
|
||||
|
||||
@@ -9,28 +9,28 @@
|
||||
import Foundation
|
||||
|
||||
/// File browser containing navigation controller.
|
||||
public class FileBrowser: UINavigationController {
|
||||
open class FileBrowser: UINavigationController {
|
||||
|
||||
let parser = FileParser.sharedInstance
|
||||
|
||||
var fileList: FileListViewController?
|
||||
|
||||
/// File types to exclude from the file browser.
|
||||
public var excludesFileExtensions: [String]? {
|
||||
open var excludesFileExtensions: [String]? {
|
||||
didSet {
|
||||
parser.excludesFileExtensions = excludesFileExtensions
|
||||
}
|
||||
}
|
||||
|
||||
/// File paths to exclude from the file browser.
|
||||
public var excludesFilepaths: [NSURL]? {
|
||||
open var excludesFilepaths: [URL]? {
|
||||
didSet {
|
||||
parser.excludesFilepaths = excludesFilepaths
|
||||
}
|
||||
}
|
||||
|
||||
/// Override default preview and actionsheet behaviour in favour of custom file handling.
|
||||
public var didSelectFile: ((FBFile) -> ())? {
|
||||
open var didSelectFile: ((FBFile) -> ())? {
|
||||
didSet {
|
||||
fileList?.didSelectFile = didSelectFile
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class FileBrowser: UINavigationController {
|
||||
public convenience init() {
|
||||
let parser = FileParser.sharedInstance
|
||||
let path = parser.documentsURL()
|
||||
self.init(initialPath: path)
|
||||
self.init(initialPath: path as URL)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,11 +54,11 @@ public class FileBrowser: UINavigationController {
|
||||
|
||||
- returns: File browser view controller.
|
||||
*/
|
||||
public convenience init(initialPath: NSURL) {
|
||||
public convenience init(initialPath: URL) {
|
||||
let fileListViewController = FileListViewController(initialPath: initialPath)
|
||||
self.init(rootViewController: fileListViewController)
|
||||
self.view.backgroundColor = UIColor.whiteColor()
|
||||
self.view.backgroundColor = UIColor.white
|
||||
self.fileList = fileListViewController
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,17 +15,17 @@ extension FileListViewController: UIViewControllerPreviewingDelegate {
|
||||
|
||||
func registerFor3DTouch() {
|
||||
if #available(iOS 9.0, *) {
|
||||
if self.traitCollection.forceTouchCapability == UIForceTouchCapability.Available {
|
||||
registerForPreviewingWithDelegate(self, sourceView: tableView)
|
||||
if self.traitCollection.forceTouchCapability == UIForceTouchCapability.available {
|
||||
registerForPreviewing(with: self, sourceView: tableView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
|
||||
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
|
||||
if #available(iOS 9.0, *) {
|
||||
if let indexPath = tableView.indexPathForRowAtPoint(location) {
|
||||
if let indexPath = tableView.indexPathForRow(at: location) {
|
||||
let selectedFile = fileForIndexPath(indexPath)
|
||||
previewingContext.sourceRect = tableView.rectForRowAtIndexPath(indexPath)
|
||||
previewingContext.sourceRect = tableView.rectForRow(at: indexPath)
|
||||
if selectedFile.isDirectory == false {
|
||||
return previewManager.previewViewControllerForFile(selectedFile, fromNavigation: false)
|
||||
}
|
||||
@@ -34,7 +34,7 @@ extension FileListViewController: UIViewControllerPreviewingDelegate {
|
||||
return nil
|
||||
}
|
||||
|
||||
func previewingContext(previewingContext: UIViewControllerPreviewing, commitViewController viewControllerToCommit: UIViewController) {
|
||||
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
|
||||
if let previewTransitionViewController = viewControllerToCommit as? PreviewTransitionViewController {
|
||||
self.navigationController?.pushViewController(previewTransitionViewController.quickLookPreviewController, animated: true)
|
||||
}
|
||||
|
||||
@@ -11,21 +11,21 @@ import Foundation
|
||||
extension FileListViewController: UISearchBarDelegate, UISearchControllerDelegate, UISearchResultsUpdating {
|
||||
|
||||
// MARK: UISearchControllerDelegate
|
||||
func willPresentSearchController(searchController: UISearchController) {
|
||||
func willPresentSearchController(_ searchController: UISearchController) {
|
||||
self.tableView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0)
|
||||
}
|
||||
|
||||
func willDismissSearchController(searchController: UISearchController) {
|
||||
func willDismissSearchController(_ searchController: UISearchController) {
|
||||
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
// MARK: UISearchBarDelegate
|
||||
func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {
|
||||
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
|
||||
filterContentForSearchText(searchBar.text!)
|
||||
}
|
||||
|
||||
// MARK: UISearchResultsUpdating
|
||||
func updateSearchResultsForSearchController(searchController: UISearchController) {
|
||||
func updateSearchResults(for searchController: UISearchController) {
|
||||
filterContentForSearchText(searchController.searchBar.text!)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,36 +12,36 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
|
||||
//MARK: UITableViewDataSource, UITableViewDelegate
|
||||
|
||||
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
if searchController.active {
|
||||
func numberOfSections(in tableView: UITableView) -> Int {
|
||||
if searchController.isActive {
|
||||
return 1
|
||||
}
|
||||
return sections.count
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
if searchController.active {
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
if searchController.isActive {
|
||||
return filteredFiles.count
|
||||
}
|
||||
return sections[section].count
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cellIdentifier = "FileCell"
|
||||
var cell = UITableViewCell(style: .Subtitle, reuseIdentifier: cellIdentifier)
|
||||
if let reuseCell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier) {
|
||||
var cell = UITableViewCell(style: .subtitle, reuseIdentifier: cellIdentifier)
|
||||
if let reuseCell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier) {
|
||||
cell = reuseCell
|
||||
}
|
||||
cell.selectionStyle = .Blue
|
||||
cell.selectionStyle = .blue
|
||||
let selectedFile = fileForIndexPath(indexPath)
|
||||
cell.textLabel?.text = selectedFile.displayName
|
||||
cell.imageView?.image = selectedFile.type.image()
|
||||
return cell
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
let selectedFile = fileForIndexPath(indexPath)
|
||||
searchController.active = false
|
||||
searchController.isActive = false
|
||||
if selectedFile.isDirectory {
|
||||
let fileListViewController = FileListViewController(initialPath: selectedFile.filePath)
|
||||
fileListViewController.didSelectFile = didSelectFile
|
||||
@@ -57,11 +57,11 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
self.navigationController?.pushViewController(filePreview, animated: true)
|
||||
}
|
||||
}
|
||||
tableView.deselectRowAtIndexPath(indexPath, animated: true)
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||
if searchController.active {
|
||||
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||
if searchController.isActive {
|
||||
return nil
|
||||
}
|
||||
if sections[section].count > 0 {
|
||||
@@ -72,19 +72,19 @@ extension FileListViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func sectionIndexTitlesForTableView(tableView: UITableView) -> [String]? {
|
||||
if searchController.active {
|
||||
func sectionIndexTitles(for tableView: UITableView) -> [String]? {
|
||||
if searchController.isActive {
|
||||
return nil
|
||||
}
|
||||
return collation.sectionIndexTitles
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, sectionForSectionIndexTitle title: String, atIndex index: Int) -> Int {
|
||||
if searchController.active {
|
||||
func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int {
|
||||
if searchController.isActive {
|
||||
return 0
|
||||
}
|
||||
return collation.sectionForSectionIndexTitleAtIndex(index)
|
||||
return collation.section(forSectionIndexTitle: index)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ class FileListViewController: UIViewController {
|
||||
|
||||
// TableView
|
||||
@IBOutlet weak var tableView: UITableView!
|
||||
let collation = UILocalizedIndexedCollation.currentCollation()
|
||||
let collation = UILocalizedIndexedCollation.current()
|
||||
|
||||
/// Data
|
||||
var didSelectFile: ((FBFile) -> ())?
|
||||
var files = [FBFile]()
|
||||
var initialPath: NSURL?
|
||||
var initialPath: URL?
|
||||
let parser = FileParser.sharedInstance
|
||||
let previewManager = PreviewManager()
|
||||
var sections: [[FBFile]] = []
|
||||
@@ -26,8 +26,8 @@ class FileListViewController: UIViewController {
|
||||
var filteredFiles = [FBFile]()
|
||||
let searchController: UISearchController = {
|
||||
let searchController = UISearchController(searchResultsController: nil)
|
||||
searchController.searchBar.searchBarStyle = .Minimal
|
||||
searchController.searchBar.backgroundColor = UIColor.whiteColor()
|
||||
searchController.searchBar.searchBarStyle = .minimal
|
||||
searchController.searchBar.backgroundColor = UIColor.white
|
||||
searchController.dimsBackgroundDuringPresentation = false
|
||||
return searchController
|
||||
}()
|
||||
@@ -35,9 +35,9 @@ class FileListViewController: UIViewController {
|
||||
|
||||
//MARK: Lifecycle
|
||||
|
||||
convenience init (initialPath: NSURL) {
|
||||
self.init(nibName: "FileBrowser", bundle: NSBundle(forClass: FileListViewController.self))
|
||||
self.edgesForExtendedLayout = .None
|
||||
convenience init (initialPath: URL) {
|
||||
self.init(nibName: "FileBrowser", bundle: Bundle(for: FileListViewController.self))
|
||||
self.edgesForExtendedLayout = UIRectEdge()
|
||||
|
||||
// Set initial path
|
||||
self.initialPath = initialPath
|
||||
@@ -49,7 +49,7 @@ class FileListViewController: UIViewController {
|
||||
searchController.delegate = self
|
||||
|
||||
// Add dismiss button
|
||||
let dismissButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(FileListViewController.dismiss))
|
||||
let dismissButton = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(FileListViewController.dismiss(button:)))
|
||||
self.navigationItem.rightBarButtonItem = dismissButton
|
||||
|
||||
}
|
||||
@@ -79,47 +79,47 @@ class FileListViewController: UIViewController {
|
||||
self.registerFor3DTouch()
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
// Scroll to hide search bar
|
||||
self.tableView.contentOffset = CGPointMake(0, searchController.searchBar.frame.size.height)
|
||||
self.tableView.contentOffset = CGPoint(x: 0, y: searchController.searchBar.frame.size.height)
|
||||
|
||||
// Make sure navigation bar is visible
|
||||
self.navigationController?.navigationBarHidden = false
|
||||
self.navigationController?.isNavigationBarHidden = false
|
||||
}
|
||||
|
||||
func dismiss() {
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
@objc func dismiss(button: UIBarButtonItem = UIBarButtonItem()) {
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
//MARK: Data
|
||||
|
||||
func indexFiles() {
|
||||
let selector: Selector = Selector("displayName")
|
||||
sections = Array(count: collation.sectionTitles.count, repeatedValue: [])
|
||||
if let sortedObjects = collation.sortedArrayFromArray(files, collationStringSelector: selector) as? [FBFile]{
|
||||
let selector: Selector = #selector(getter: UIPrinter.displayName)
|
||||
sections = Array(repeating: [], count: collation.sectionTitles.count)
|
||||
if let sortedObjects = collation.sortedArray(from: files, collationStringSelector: selector) as? [FBFile]{
|
||||
for object in sortedObjects {
|
||||
let sectionNumber = collation.sectionForObject(object, collationStringSelector: selector)
|
||||
let sectionNumber = collation.section(for: object, collationStringSelector: selector)
|
||||
sections[sectionNumber].append(object)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fileForIndexPath(indexPath: NSIndexPath) -> FBFile {
|
||||
func fileForIndexPath(_ indexPath: IndexPath) -> FBFile {
|
||||
var file: FBFile
|
||||
if searchController.active {
|
||||
file = filteredFiles[indexPath.row]
|
||||
if searchController.isActive {
|
||||
file = filteredFiles[(indexPath as NSIndexPath).row]
|
||||
}
|
||||
else {
|
||||
file = sections[indexPath.section][indexPath.row]
|
||||
file = sections[(indexPath as NSIndexPath).section][(indexPath as NSIndexPath).row]
|
||||
}
|
||||
return file
|
||||
}
|
||||
|
||||
func filterContentForSearchText(searchText: String) {
|
||||
func filterContentForSearchText(_ searchText: String) {
|
||||
filteredFiles = files.filter({ (file: FBFile) -> Bool in
|
||||
return file.displayName.lowercaseString.containsString(searchText.lowercaseString)
|
||||
return file.displayName.lowercased().contains(searchText.lowercased())
|
||||
})
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class FileParser {
|
||||
/// Mapped for case insensitivity
|
||||
var excludesFileExtensions: [String]? {
|
||||
get {
|
||||
return _excludesFileExtensions.map({$0.lowercaseString})
|
||||
return _excludesFileExtensions.map({$0.lowercased()})
|
||||
}
|
||||
set {
|
||||
if let newValue = newValue {
|
||||
@@ -26,30 +26,30 @@ class FileParser {
|
||||
}
|
||||
}
|
||||
|
||||
var excludesFilepaths: [NSURL]?
|
||||
var excludesFilepaths: [URL]?
|
||||
|
||||
let fileManager = NSFileManager.defaultManager()
|
||||
let fileManager = FileManager.default
|
||||
|
||||
func documentsURL() -> NSURL {
|
||||
return fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
|
||||
func documentsURL() -> URL {
|
||||
return fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL
|
||||
}
|
||||
|
||||
func filesForDirectory(directoryPath: NSURL) -> [FBFile] {
|
||||
func filesForDirectory(_ directoryPath: URL) -> [FBFile] {
|
||||
var files = [FBFile]()
|
||||
var filePaths = [NSURL]()
|
||||
var filePaths = [URL]()
|
||||
// Get contents
|
||||
do {
|
||||
filePaths = try self.fileManager.contentsOfDirectoryAtURL(directoryPath, includingPropertiesForKeys: [], options: [.SkipsHiddenFiles])
|
||||
filePaths = try self.fileManager.contentsOfDirectory(at: directoryPath, includingPropertiesForKeys: [], options: [.skipsHiddenFiles])
|
||||
} catch {
|
||||
return files
|
||||
}
|
||||
// Parse
|
||||
for filePath in filePaths {
|
||||
let file = FBFile(filePath: filePath)
|
||||
if let excludesFileExtensions = excludesFileExtensions, let fileExtensions = file.fileExtension where excludesFileExtensions.contains(fileExtensions) {
|
||||
if let excludesFileExtensions = excludesFileExtensions, let fileExtensions = file.fileExtension , excludesFileExtensions.contains(fileExtensions) {
|
||||
continue
|
||||
}
|
||||
if let excludesFilepaths = excludesFilepaths where excludesFilepaths.contains(file.filePath) {
|
||||
if let excludesFilepaths = excludesFilepaths , excludesFilepaths.contains(file.filePath) {
|
||||
continue
|
||||
}
|
||||
if file.displayName.isEmpty == false {
|
||||
@@ -57,7 +57,7 @@ class FileParser {
|
||||
}
|
||||
}
|
||||
// Sort
|
||||
files = files.sort(){$0.displayName < $1.displayName}
|
||||
files = files.sorted(){$0.displayName < $1.displayName}
|
||||
return files
|
||||
}
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.4</string>
|
||||
<string>0.2.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>5</string>
|
||||
<string>6</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
|
||||
@@ -11,20 +11,20 @@ import QuickLook
|
||||
|
||||
class PreviewManager: NSObject, QLPreviewControllerDataSource {
|
||||
|
||||
var filePath: NSURL?
|
||||
var filePath: URL?
|
||||
|
||||
func previewViewControllerForFile(file: FBFile, fromNavigation: Bool) -> UIViewController {
|
||||
func previewViewControllerForFile(_ file: FBFile, fromNavigation: Bool) -> UIViewController {
|
||||
|
||||
if file.type == .PLIST || file.type == .JSON{
|
||||
let webviewPreviewViewContoller = WebviewPreviewViewContoller(nibName: "WebviewPreviewViewContoller", bundle: NSBundle(forClass: WebviewPreviewViewContoller.self))
|
||||
let webviewPreviewViewContoller = WebviewPreviewViewContoller(nibName: "WebviewPreviewViewContoller", bundle: Bundle(for: WebviewPreviewViewContoller.self))
|
||||
webviewPreviewViewContoller.file = file
|
||||
return webviewPreviewViewContoller
|
||||
}
|
||||
else {
|
||||
let previewTransitionViewController = PreviewTransitionViewController(nibName: "PreviewTransitionViewController", bundle: NSBundle(forClass: PreviewTransitionViewController.self))
|
||||
let previewTransitionViewController = PreviewTransitionViewController(nibName: "PreviewTransitionViewController", bundle: Bundle(for: PreviewTransitionViewController.self))
|
||||
previewTransitionViewController.quickLookPreviewController.dataSource = self
|
||||
|
||||
self.filePath = file.filePath
|
||||
self.filePath = file.filePath as URL
|
||||
if fromNavigation == true {
|
||||
return previewTransitionViewController.quickLookPreviewController
|
||||
}
|
||||
@@ -33,11 +33,11 @@ class PreviewManager: NSObject, QLPreviewControllerDataSource {
|
||||
}
|
||||
|
||||
|
||||
func numberOfPreviewItemsInPreviewController(controller: QLPreviewController) -> Int {
|
||||
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
func previewController(controller: QLPreviewController, previewItemAtIndex index: Int) -> QLPreviewItem {
|
||||
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
|
||||
let item = PreviewItem()
|
||||
if let filePath = filePath {
|
||||
item.filePath = filePath
|
||||
@@ -49,13 +49,17 @@ class PreviewManager: NSObject, QLPreviewControllerDataSource {
|
||||
|
||||
class PreviewItem: NSObject, QLPreviewItem {
|
||||
|
||||
var filePath: NSURL?
|
||||
/*!
|
||||
* @abstract The URL of the item to preview.
|
||||
* @discussion The URL must be a file URL.
|
||||
*/
|
||||
|
||||
internal var previewItemURL: NSURL {
|
||||
var filePath: URL?
|
||||
public var previewItemURL: URL? {
|
||||
if let filePath = filePath {
|
||||
return filePath
|
||||
}
|
||||
return NSURL()
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class PreviewTransitionViewController: UIViewController {
|
||||
self.addChildViewController(quickLookPreviewController)
|
||||
containerView.addSubview(quickLookPreviewController.view)
|
||||
quickLookPreviewController.view.frame = containerView.bounds
|
||||
quickLookPreviewController.didMoveToParentViewController(self)
|
||||
quickLookPreviewController.didMove(toParentViewController: self)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
return
|
||||
}
|
||||
let activityViewController = UIActivityViewController(activityItems: [file.filePath], applicationActivities: nil)
|
||||
self.presentViewController(activityViewController, animated: true, completion: nil)
|
||||
self.present(activityViewController, animated: true, completion: nil)
|
||||
|
||||
}
|
||||
|
||||
//MARK: Processing
|
||||
|
||||
func processForDisplay() {
|
||||
guard let file = file, let data = NSData(contentsOfURL: file.filePath) else {
|
||||
guard let file = file, let data = try? Data(contentsOf: file.filePath as URL) else {
|
||||
return
|
||||
}
|
||||
var rawString: String?
|
||||
@@ -59,7 +59,7 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
// Prepare plist for display
|
||||
if file.type == .PLIST {
|
||||
do {
|
||||
if let plistDescription = try NSPropertyListSerialization.propertyListWithData(data, options: [], format: nil).description {
|
||||
if let plistDescription = try (PropertyListSerialization.propertyList(from: data, options: [], format: nil) as AnyObject).description {
|
||||
rawString = plistDescription
|
||||
}
|
||||
} catch {}
|
||||
@@ -68,12 +68,12 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
// Prepare json file for display
|
||||
else if file.type == .JSON {
|
||||
do {
|
||||
let jsonObject = try NSJSONSerialization.JSONObjectWithData(data, options: [])
|
||||
if NSJSONSerialization.isValidJSONObject(jsonObject) {
|
||||
let prettyJSON = try NSJSONSerialization.dataWithJSONObject(jsonObject, options: .PrettyPrinted)
|
||||
var jsonString = String(data: prettyJSON, encoding: NSUTF8StringEncoding)
|
||||
let jsonObject = try JSONSerialization.jsonObject(with: data, options: [])
|
||||
if JSONSerialization.isValidJSONObject(jsonObject) {
|
||||
let prettyJSON = try JSONSerialization.data(withJSONObject: jsonObject, options: .prettyPrinted)
|
||||
var jsonString = String(data: prettyJSON, encoding: String.Encoding.utf8)
|
||||
// Unescape forward slashes
|
||||
jsonString = jsonString?.stringByReplacingOccurrencesOfString("\\/", withString: "/")
|
||||
jsonString = jsonString?.replacingOccurrences(of: "\\/", with: "/")
|
||||
rawString = jsonString
|
||||
}
|
||||
} catch {}
|
||||
@@ -81,7 +81,7 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
|
||||
// Default prepare for display
|
||||
if rawString == nil {
|
||||
rawString = String(data: data, encoding: NSUTF8StringEncoding)
|
||||
rawString = String(data: data, encoding: String.Encoding.utf8)
|
||||
}
|
||||
|
||||
// Convert and display string
|
||||
@@ -95,7 +95,7 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
|
||||
// Make sure we convert HTML special characters
|
||||
// Code from https://gist.github.com/mikesteele/70ae98d04fdc35cb1d5f
|
||||
func convertSpecialCharacters(string: String?) -> String? {
|
||||
func convertSpecialCharacters(_ string: String?) -> String? {
|
||||
guard let string = string else {
|
||||
return nil
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
"'": "'"
|
||||
];
|
||||
for (escaped_char, unescaped_char) in char_dictionary {
|
||||
newString = newString.stringByReplacingOccurrencesOfString(escaped_char, withString: unescaped_char, options: NSStringCompareOptions.RegularExpressionSearch, range: nil)
|
||||
newString = newString.replacingOccurrences(of: escaped_char, with: unescaped_char, options: NSString.CompareOptions.regularExpression, range: nil)
|
||||
}
|
||||
return newString
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class FileBrowserTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testGifFBFileParse() {
|
||||
let filePath = NSBundle(forClass: FileBrowserTests.self).URLForResource("3crBXeO", withExtension: "gif")!
|
||||
let filePath = Bundle(for: FileBrowserTests.self).url(forResource: "3crBXeO", withExtension: "gif")!
|
||||
let file = FBFile(filePath: filePath)
|
||||
XCTAssertEqual(file.filePath, filePath)
|
||||
XCTAssertEqual(file.isDirectory, false)
|
||||
@@ -31,7 +31,7 @@ class FileBrowserTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testJpgFBFileParse() {
|
||||
let filePath = NSBundle(forClass: FileBrowserTests.self).URLForResource("Stitch", withExtension: "jpg")!
|
||||
let filePath = Bundle(for: FileBrowserTests.self).url(forResource: "Stitch", withExtension: "jpg")!
|
||||
let file = FBFile(filePath: filePath)
|
||||
XCTAssertEqual(file.filePath, filePath)
|
||||
XCTAssertEqual(file.isDirectory, false)
|
||||
@@ -40,14 +40,14 @@ class FileBrowserTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testDirectoryFBFileParse() {
|
||||
let filePath = NSBundle(forClass: FileBrowserTests.self).bundleURL
|
||||
let filePath = Bundle(for: FileBrowserTests.self).bundleURL
|
||||
let file = FBFile(filePath: filePath)
|
||||
XCTAssertEqual(file.type, FBFileType.Directory)
|
||||
}
|
||||
|
||||
func testDirectoryContentsParse() {
|
||||
let parser = FileParser.sharedInstance
|
||||
let directoryPath = NSBundle(forClass: FileBrowserTests.self).bundleURL
|
||||
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
|
||||
@@ -60,7 +60,7 @@ class FileBrowserTests: XCTestCase {
|
||||
func testCaseSensitiveExclusion() {
|
||||
let parser = FileParser.sharedInstance
|
||||
parser.excludesFileExtensions = ["gIf"]
|
||||
let directoryPath = NSBundle(forClass: FileBrowserTests.self).bundleURL
|
||||
let directoryPath = Bundle(for: FileBrowserTests.self).bundleURL
|
||||
let directoryContents = parser.filesForDirectory(directoryPath)
|
||||
for file in directoryContents {
|
||||
if let fileExtension = file.fileExtension {
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.4</string>
|
||||
<string>0.2.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>5</string>
|
||||
<string>6</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,69 @@
|
||||
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
|
||||
@@ -31,7 +31,7 @@ import FileBrowser
|
||||
To show the file browser, all you need to do is:
|
||||
```swift
|
||||
let fileBrowser = FileBrowser()
|
||||
self.presentViewController(fileBrowser, animated: true, completion: nil)
|
||||
present(file, 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.
|
||||
@@ -59,7 +59,7 @@ fileBrowser.excludesFilepaths = [secretFile]
|
||||
### Setting up with [CocoaPods](http://cocoapods.org/?q=FileBrowser)
|
||||
```ruby
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
pod 'FileBrowser', '~> 0.1'
|
||||
pod 'FileBrowser', '~> 0.2'
|
||||
```
|
||||
|
||||
### Setting up with Carthage
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# **** Update me when new Xcode versions are released! ****
|
||||
PLATFORM="platform=iOS Simulator,OS=9.2,name=iPhone 6"
|
||||
SDK="iphonesimulator9.3"
|
||||
PLATFORM="platform=iOS Simulator,OS=10.0,name=iPhone 7"
|
||||
SDK="iphonesimulator10.0"
|
||||
|
||||
|
||||
# It is pitch black.
|
||||
|
||||
@@ -2,4 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git'
|
||||
platform :ios, "8.0"
|
||||
use_frameworks!
|
||||
|
||||
pod 'FileBrowser', :path => '../..'
|
||||
target 'Sample' do
|
||||
pod 'FileBrowser', :path => '../..'
|
||||
end
|
||||
|
||||
@@ -7,30 +7,20 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
3430F6711C45C930007473A6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430F6701C45C930007473A6 /* AppDelegate.swift */; };
|
||||
3430F6761C45C930007473A6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3430F6741C45C930007473A6 /* Main.storyboard */; };
|
||||
3430F6781C45C930007473A6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3430F6771C45C930007473A6 /* Assets.xcassets */; };
|
||||
3430F67B1C45C930007473A6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3430F6791C45C930007473A6 /* LaunchScreen.storyboard */; };
|
||||
3430F6861C45C930007473A6 /* SampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430F6851C45C930007473A6 /* SampleTests.swift */; };
|
||||
3437406C1C6E7ECB0090FD6A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3437406B1C6E7ECB0090FD6A /* ViewController.swift */; };
|
||||
3467DAF31C4BF17900BA3DB8 /* Baymax.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3467DAEF1C4BF17900BA3DB8 /* Baymax.jpg */; };
|
||||
3467DAF41C4BF17900BA3DB8 /* BB8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3467DAF01C4BF17900BA3DB8 /* BB8.jpg */; };
|
||||
3467DAF51C4BF17900BA3DB8 /* Stitch.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3467DAF11C4BF17900BA3DB8 /* Stitch.jpg */; };
|
||||
3467DAF61C4BF17900BA3DB8 /* Images.zip in Resources */ = {isa = PBXBuildFile; fileRef = 3467DAF21C4BF17900BA3DB8 /* Images.zip */; };
|
||||
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 */; };
|
||||
48A24C331D8C59250044C697 /* FileBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48A24C321D8C59250044C697 /* FileBrowser.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
3430F6821C45C930007473A6 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 3430F6651C45C930007473A6 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 3430F66C1C45C930007473A6;
|
||||
remoteInfo = Sample;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
3430F69D1C45C949007473A6 /* Embed Frameworks */ = {
|
||||
48A199DD1D8C564100C443D3 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
@@ -43,95 +33,109 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
3430F66D1C45C930007473A6 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3430F6701C45C930007473A6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
3430F6751C45C930007473A6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
3430F6771C45C930007473A6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
3430F67A1C45C930007473A6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
3430F67C1C45C930007473A6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
3430F6811C45C930007473A6 /* SampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3430F6851C45C930007473A6 /* SampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleTests.swift; sourceTree = "<group>"; };
|
||||
3430F6871C45C930007473A6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
3437406B1C6E7ECB0090FD6A /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
3467DAEF1C4BF17900BA3DB8 /* Baymax.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Baymax.jpg; sourceTree = "<group>"; };
|
||||
3467DAF01C4BF17900BA3DB8 /* BB8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = BB8.jpg; sourceTree = "<group>"; };
|
||||
3467DAF11C4BF17900BA3DB8 /* Stitch.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Stitch.jpg; sourceTree = "<group>"; };
|
||||
3467DAF21C4BF17900BA3DB8 /* Images.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Images.zip; 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>"; };
|
||||
48A199BA1D8C53AC00C443D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
48A199C31D8C53DB00C443D3 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = "Supporting Files/AppDelegate.swift"; sourceTree = "<group>"; };
|
||||
48A199C41D8C53DB00C443D3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Supporting Files/Info.plist"; sourceTree = "<group>"; };
|
||||
48A199C71D8C53E200C443D3 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MainViewController.swift; path = "View Controller/MainViewController.swift"; sourceTree = "<group>"; };
|
||||
48A199C91D8C546000C443D3 /* Baymax.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Baymax.jpg; sourceTree = "<group>"; };
|
||||
48A199CA1D8C546000C443D3 /* BB8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = BB8.jpg; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
3430F66A1C45C930007473A6 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3430F67E1C45C930007473A6 /* Frameworks */ = {
|
||||
48A199AA1D8C53AC00C443D3 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
48A24C331D8C59250044C697 /* FileBrowser.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
3430F6641C45C930007473A6 = {
|
||||
48A199A41D8C53AC00C443D3 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3430F66F1C45C930007473A6 /* Sample */,
|
||||
3430F6841C45C930007473A6 /* SampleTests */,
|
||||
3430F66E1C45C930007473A6 /* Products */,
|
||||
48A199AF1D8C53AC00C443D3 /* Sample */,
|
||||
48A199AE1D8C53AC00C443D3 /* Products */,
|
||||
48A24C2F1D8C57390044C697 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3430F66E1C45C930007473A6 /* Products */ = {
|
||||
48A199AE1D8C53AC00C443D3 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3430F66D1C45C930007473A6 /* Sample.app */,
|
||||
3430F6811C45C930007473A6 /* SampleTests.xctest */,
|
||||
48A199AD1D8C53AC00C443D3 /* Sample.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3430F66F1C45C930007473A6 /* Sample */ = {
|
||||
48A199AF1D8C53AC00C443D3 /* Sample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3430F6701C45C930007473A6 /* AppDelegate.swift */,
|
||||
3437406B1C6E7ECB0090FD6A /* ViewController.swift */,
|
||||
3467DAEF1C4BF17900BA3DB8 /* Baymax.jpg */,
|
||||
3467DAF01C4BF17900BA3DB8 /* BB8.jpg */,
|
||||
3467DAF11C4BF17900BA3DB8 /* Stitch.jpg */,
|
||||
3467DAF21C4BF17900BA3DB8 /* Images.zip */,
|
||||
3430F6741C45C930007473A6 /* Main.storyboard */,
|
||||
3430F6771C45C930007473A6 /* Assets.xcassets */,
|
||||
3430F6791C45C930007473A6 /* LaunchScreen.storyboard */,
|
||||
3430F67C1C45C930007473A6 /* Info.plist */,
|
||||
48A199D21D8C546F00C443D3 /* View Controller */,
|
||||
48A199C21D8C53B700C443D3 /* Supporting Files */,
|
||||
);
|
||||
path = Sample;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3430F6841C45C930007473A6 /* SampleTests */ = {
|
||||
48A199C21D8C53B700C443D3 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3430F6851C45C930007473A6 /* SampleTests.swift */,
|
||||
3430F6871C45C930007473A6 /* Info.plist */,
|
||||
48A199D11D8C546500C443D3 /* Resources */,
|
||||
48A199C31D8C53DB00C443D3 /* AppDelegate.swift */,
|
||||
48A199C41D8C53DB00C443D3 /* Info.plist */,
|
||||
48A199B41D8C53AC00C443D3 /* Main.storyboard */,
|
||||
48A199B71D8C53AC00C443D3 /* Assets.xcassets */,
|
||||
48A199B91D8C53AC00C443D3 /* LaunchScreen.storyboard */,
|
||||
);
|
||||
path = SampleTests;
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
48A199D11D8C546500C443D3 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
48A199C91D8C546000C443D3 /* Baymax.jpg */,
|
||||
48A199CA1D8C546000C443D3 /* BB8.jpg */,
|
||||
48A199CB1D8C546000C443D3 /* Images.zip */,
|
||||
48A199CC1D8C546000C443D3 /* Stitch.jpg */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
48A199D21D8C546F00C443D3 /* View Controller */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
48A199C71D8C53E200C443D3 /* MainViewController.swift */,
|
||||
);
|
||||
name = "View Controller";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
48A24C2F1D8C57390044C697 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
48A24C321D8C59250044C697 /* FileBrowser.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
3430F66C1C45C930007473A6 /* Sample */ = {
|
||||
48A199AC1D8C53AC00C443D3 /* Sample */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3430F68A1C45C930007473A6 /* Build configuration list for PBXNativeTarget "Sample" */;
|
||||
buildConfigurationList = 48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */;
|
||||
buildPhases = (
|
||||
3430F6691C45C930007473A6 /* Sources */,
|
||||
3430F66A1C45C930007473A6 /* Frameworks */,
|
||||
3430F66B1C45C930007473A6 /* Resources */,
|
||||
3430F69D1C45C949007473A6 /* Embed Frameworks */,
|
||||
48A199A91D8C53AC00C443D3 /* Sources */,
|
||||
48A199AA1D8C53AC00C443D3 /* Frameworks */,
|
||||
48A199AB1D8C53AC00C443D3 /* Resources */,
|
||||
48A199DD1D8C564100C443D3 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -139,47 +143,28 @@
|
||||
);
|
||||
name = Sample;
|
||||
productName = Sample;
|
||||
productReference = 3430F66D1C45C930007473A6 /* Sample.app */;
|
||||
productReference = 48A199AD1D8C53AC00C443D3 /* Sample.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
3430F6801C45C930007473A6 /* SampleTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3430F68D1C45C930007473A6 /* Build configuration list for PBXNativeTarget "SampleTests" */;
|
||||
buildPhases = (
|
||||
3430F67D1C45C930007473A6 /* Sources */,
|
||||
3430F67E1C45C930007473A6 /* Frameworks */,
|
||||
3430F67F1C45C930007473A6 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
3430F6831C45C930007473A6 /* PBXTargetDependency */,
|
||||
);
|
||||
name = SampleTests;
|
||||
productName = SampleTests;
|
||||
productReference = 3430F6811C45C930007473A6 /* SampleTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
3430F6651C45C930007473A6 /* Project object */ = {
|
||||
48A199A51D8C53AC00C443D3 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0720;
|
||||
ORGANIZATIONNAME = "Roy Marmelstein";
|
||||
LastSwiftUpdateCheck = 0800;
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = "Mihail Șalari";
|
||||
TargetAttributes = {
|
||||
3430F66C1C45C930007473A6 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
};
|
||||
3430F6801C45C930007473A6 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
TestTargetID = 3430F66C1C45C930007473A6;
|
||||
48A199AC1D8C53AC00C443D3 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
DevelopmentTeam = U82TG7992X;
|
||||
LastSwiftMigration = 0800;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 3430F6681C45C930007473A6 /* Build configuration list for PBXProject "Sample" */;
|
||||
buildConfigurationList = 48A199A81D8C53AC00C443D3 /* Build configuration list for PBXProject "Sample" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
@@ -187,82 +172,58 @@
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 3430F6641C45C930007473A6;
|
||||
productRefGroup = 3430F66E1C45C930007473A6 /* Products */;
|
||||
mainGroup = 48A199A41D8C53AC00C443D3;
|
||||
productRefGroup = 48A199AE1D8C53AC00C443D3 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3430F66C1C45C930007473A6 /* Sample */,
|
||||
3430F6801C45C930007473A6 /* SampleTests */,
|
||||
48A199AC1D8C53AC00C443D3 /* Sample */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
3430F66B1C45C930007473A6 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3467DAF41C4BF17900BA3DB8 /* BB8.jpg in Resources */,
|
||||
3467DAF51C4BF17900BA3DB8 /* Stitch.jpg in Resources */,
|
||||
3430F67B1C45C930007473A6 /* LaunchScreen.storyboard in Resources */,
|
||||
3467DAF61C4BF17900BA3DB8 /* Images.zip in Resources */,
|
||||
3467DAF31C4BF17900BA3DB8 /* Baymax.jpg in Resources */,
|
||||
3430F6781C45C930007473A6 /* Assets.xcassets in Resources */,
|
||||
3430F6761C45C930007473A6 /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3430F67F1C45C930007473A6 /* Resources */ = {
|
||||
48A199AB1D8C53AC00C443D3 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
48A199BB1D8C53AC00C443D3 /* LaunchScreen.storyboard in Resources */,
|
||||
48A199CF1D8C546000C443D3 /* Images.zip 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 */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
3430F6691C45C930007473A6 /* Sources */ = {
|
||||
48A199A91D8C53AC00C443D3 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3437406C1C6E7ECB0090FD6A /* ViewController.swift in Sources */,
|
||||
3430F6711C45C930007473A6 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3430F67D1C45C930007473A6 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3430F6861C45C930007473A6 /* SampleTests.swift in Sources */,
|
||||
48A199C81D8C53E200C443D3 /* MainViewController.swift in Sources */,
|
||||
48A199C51D8C53DB00C443D3 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
3430F6831C45C930007473A6 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 3430F66C1C45C930007473A6 /* Sample */;
|
||||
targetProxy = 3430F6821C45C930007473A6 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
3430F6741C45C930007473A6 /* Main.storyboard */ = {
|
||||
48A199B41D8C53AC00C443D3 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
3430F6751C45C930007473A6 /* Base */,
|
||||
48A199B51D8C53AC00C443D3 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3430F6791C45C930007473A6 /* LaunchScreen.storyboard */ = {
|
||||
48A199B91D8C53AC00C443D3 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
3430F67A1C45C930007473A6 /* Base */,
|
||||
48A199BA1D8C53AC00C443D3 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
@@ -270,10 +231,11 @@
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
3430F6881C45C930007473A6 /* Debug */ = {
|
||||
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;
|
||||
@@ -281,10 +243,13 @@
|
||||
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_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -306,18 +271,21 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
|
||||
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;
|
||||
};
|
||||
3430F6891C45C930007473A6 /* Release */ = {
|
||||
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;
|
||||
@@ -325,10 +293,13 @@
|
||||
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_MOVES = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -344,92 +315,70 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
|
||||
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;
|
||||
};
|
||||
3430F68B1C45C930007473A6 /* Debug */ = {
|
||||
48A199C01D8C53AC00C443D3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = Sample/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
DEVELOPMENT_TEAM = U82TG7992X;
|
||||
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_BUNDLE_IDENTIFIER = com.mihailsalari.Sample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3430F68C1C45C930007473A6 /* Release */ = {
|
||||
48A199C11D8C53AC00C443D3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = Sample/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
DEVELOPMENT_TEAM = U82TG7992X;
|
||||
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_BUNDLE_IDENTIFIER = com.mihailsalari.Sample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3430F68E1C45C930007473A6 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = SampleTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.SampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3430F68F1C45C930007473A6 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = SampleTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.SampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
3430F6681C45C930007473A6 /* Build configuration list for PBXProject "Sample" */ = {
|
||||
48A199A81D8C53AC00C443D3 /* Build configuration list for PBXProject "Sample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3430F6881C45C930007473A6 /* Debug */,
|
||||
3430F6891C45C930007473A6 /* Release */,
|
||||
48A199BD1D8C53AC00C443D3 /* Debug */,
|
||||
48A199BE1D8C53AC00C443D3 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
3430F68A1C45C930007473A6 /* Build configuration list for PBXNativeTarget "Sample" */ = {
|
||||
48A199BF1D8C53AC00C443D3 /* Build configuration list for PBXNativeTarget "Sample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3430F68B1C45C930007473A6 /* Debug */,
|
||||
3430F68C1C45C930007473A6 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
3430F68D1C45C930007473A6 /* Build configuration list for PBXNativeTarget "SampleTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3430F68E1C45C930007473A6 /* Debug */,
|
||||
3430F68F1C45C930007473A6 /* Release */,
|
||||
48A199C01D8C53AC00C443D3 /* Debug */,
|
||||
48A199C11D8C53AC00C443D3 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 3430F6651C45C930007473A6 /* Project object */;
|
||||
rootObject = 48A199A51D8C53AC00C443D3 /* Project object */;
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0720"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3430F66C1C45C930007473A6"
|
||||
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"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3430F6801C45C930007473A6"
|
||||
BuildableName = "SampleTests.xctest"
|
||||
BlueprintName = "SampleTests"
|
||||
ReferencedContainer = "container:Sample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3430F66C1C45C930007473A6"
|
||||
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"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3430F66C1C45C930007473A6"
|
||||
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 = "3430F66C1C45C930007473A6"
|
||||
BuildableName = "Sample.app"
|
||||
BlueprintName = "Sample"
|
||||
ReferencedContainer = "container:Sample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,75 +0,0 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// Sample
|
||||
//
|
||||
// Created by Roy Marmelstein on 13/01/2016.
|
||||
// Copyright © 2016 Roy Marmelstein. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
if NSUserDefaults.standardUserDefaults().boolForKey("firstLaunch") == false {
|
||||
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "firstLaunch")
|
||||
NSUserDefaults.standardUserDefaults().synchronize()
|
||||
let fileManager = NSFileManager.defaultManager()
|
||||
let fileNames = ["Baymax.jpg", "BB8.jpg", "Stitch.jpg", "Info.plist"]
|
||||
let documentsUrl = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
|
||||
let bundleUrl = NSBundle.mainBundle().resourceURL
|
||||
// Copy images to documents folder
|
||||
for file in fileNames {
|
||||
if let srcPath = bundleUrl?.URLByAppendingPathComponent(file).path, let toPath = documentsUrl.URLByAppendingPathComponent(file).path{
|
||||
do {
|
||||
try fileManager.copyItemAtPath(srcPath, toPath: toPath)
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy zip file to an images directory
|
||||
let imagesDirectoryURL = documentsUrl.URLByAppendingPathComponent("images")
|
||||
let zipFileName = "Images.zip"
|
||||
if let imagesDirectoryPath = imagesDirectoryURL.path {
|
||||
do {
|
||||
try fileManager.createDirectoryAtPath(imagesDirectoryPath, withIntermediateDirectories: false, attributes: nil)
|
||||
if let srcPath = bundleUrl?.URLByAppendingPathComponent(zipFileName).path, let toPath = imagesDirectoryURL.URLByAppendingPathComponent(zipFileName).path{
|
||||
do {
|
||||
try fileManager.copyItemAtPath(srcPath, toPath: toPath)
|
||||
} catch {}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(application: UIApplication) {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,36 @@
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 226 B |
Binary file not shown.
|
Before Width: | Height: | Size: 382 B |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "738-document-1.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "738-document-1@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 300 B |
Binary file not shown.
|
Before Width: | Height: | Size: 577 B |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "710-folder.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "710-folder@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
@@ -14,9 +14,9 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Azc-ni-1lY">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="C30-pI-Zah">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="qOO-wm-hTa">
|
||||
<!--Main-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<navigationController id="Azc-ni-1lY" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="He1-CR-cOP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="dpw-R4-j8a" kind="relationship" relationship="rootViewController" id="X2C-fJ-xJK"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="vih-dz-uz2" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="234" y="152"/>
|
||||
</scene>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="mz0-lp-3R4">
|
||||
<objects>
|
||||
<viewController id="dpw-R4-j8a" customClass="ViewController" customModule="Sample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController id="BYZ-38-t0r" customClass="MainViewController" customModule="Sample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="edF-bh-llm"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="Gww-Pp-M3Q"/>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="oeM-RL-OAb">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iNg-oP-MXE">
|
||||
<rect key="frame" x="239" y="285" width="122" height="30"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kRA-yN-jkN">
|
||||
<frame key="frameInset" minX="33.60%" minY="47.68%" width="32.53%" height="4.50%"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Show file browser"/>
|
||||
<connections>
|
||||
<action selector="showFileBrowser:" destination="dpw-R4-j8a" eventType="touchUpInside" id="G1A-x2-ExJ"/>
|
||||
<action selector="showFileBrowserWithSender:" destination="BYZ-38-t0r" eventType="touchUpInside" id="aiu-9x-Mg2"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="iNg-oP-MXE" firstAttribute="centerX" secondItem="oeM-RL-OAb" secondAttribute="centerX" id="GYA-6v-k0x"/>
|
||||
<constraint firstItem="iNg-oP-MXE" firstAttribute="centerY" secondItem="oeM-RL-OAb" secondAttribute="centerY" id="ryh-da-dpd"/>
|
||||
</constraints>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="GLl-37-stv"/>
|
||||
<navigationItem key="navigationItem" title="Main" id="loI-Tb-z6H"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="pqG-S7-8Xl" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="894" y="159"/>
|
||||
<point key="canvasLocation" x="967" y="-645"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="bMP-Dn-Jmg">
|
||||
<objects>
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="C30-pI-Zah" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="cXh-Hi-2rA">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="OnE-8Z-dJt"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="ESw-wj-Lv3" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="136.80000000000001" y="-644.52773613193403"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// Sample
|
||||
//
|
||||
// Created by Mihail Șalari on 9/16/16.
|
||||
// Copyright © 2016 Mihail Șalari. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
|
||||
self.populateTableViewWithFiles()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
fileprivate func populateTableViewWithFiles() {
|
||||
let defaultsKey = "firstLaunch"
|
||||
let userDefaults = UserDefaults.standard
|
||||
let fileManager = FileManager.default
|
||||
let fileNames = ["Baymax.jpg", "BB8.jpg", "Stitch.jpg", "Info.plist"]
|
||||
let documentsUrl = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL
|
||||
let bundleUrl = Bundle.main.resourceURL
|
||||
|
||||
// Copy zip file to an images directory
|
||||
let imagesDirectoryURL = documentsUrl.appendingPathComponent("images")
|
||||
let zipFileName = "Images.zip"
|
||||
let imagesDirectoryPath = imagesDirectoryURL.path
|
||||
|
||||
if userDefaults.bool(forKey: defaultsKey) == false {
|
||||
userDefaults.set(true, forKey: defaultsKey)
|
||||
userDefaults.synchronize()
|
||||
|
||||
// Copy images to documents folder
|
||||
for file in fileNames {
|
||||
if let srcPath = bundleUrl?.appendingPathComponent(file).path {
|
||||
let toPath = documentsUrl.appendingPathComponent(file).path
|
||||
do {
|
||||
try fileManager.copyItem(atPath: srcPath, toPath: toPath)
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy zip file to an images directory
|
||||
do {
|
||||
try fileManager.createDirectory(atPath: imagesDirectoryPath, withIntermediateDirectories: false, attributes: nil)
|
||||
if let srcPath = bundleUrl?.appendingPathComponent(zipFileName).path {
|
||||
let toPath = imagesDirectoryURL.appendingPathComponent(zipFileName).path
|
||||
do {
|
||||
try fileManager.copyItem(atPath: srcPath, toPath: toPath)
|
||||
} catch {}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-2
@@ -16,8 +16,6 @@
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
@@ -36,5 +34,12 @@
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// MainViewController.swift
|
||||
// Sample
|
||||
//
|
||||
// Created by Mihail Șalari on 9/16/16.
|
||||
// Copyright © 2016 Mihail Șalari. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import FileBrowser
|
||||
|
||||
class MainViewController: UIViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
// MARK: - FileBrowser
|
||||
|
||||
@IBAction func showFileBrowser(sender: AnyObject) {
|
||||
let file = FileBrowser()
|
||||
present(file, animated: true, completion: nil)
|
||||
//self.present(fileBrowser, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// ViewController.swift
|
||||
// Sample
|
||||
//
|
||||
// Created by Roy Marmelstein on 12/02/2016.
|
||||
// Copyright © 2016 Roy Marmelstein. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import FileBrowser
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
@IBAction func showFileBrowser(sender: AnyObject) {
|
||||
let fileBrowser = FileBrowser()
|
||||
self.presentViewController(fileBrowser, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?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>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,36 +0,0 @@
|
||||
//
|
||||
// SampleTests.swift
|
||||
// SampleTests
|
||||
//
|
||||
// Created by Roy Marmelstein on 13/01/2016.
|
||||
// Copyright © 2016 Roy Marmelstein. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import Sample
|
||||
|
||||
class SampleTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measureBlock {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user