Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 90b6bdac72 | |||
| d2ac7b6c69 | |||
| a7c94799a2 | |||
| e7c3bc8c7b | |||
| 1a135f43f1 | |||
| 500102d206 | |||
| 4896621f90 | |||
| d98b486b44 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
osx_image: xcode7.2
|
||||
osx_image: xcode7.3
|
||||
language: objective-c
|
||||
env:
|
||||
global:
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "FileBrowser"
|
||||
s.version = "0.1.1"
|
||||
s.version = "0.1.4"
|
||||
s.summary = "Powerful iOS file browser in Swift."
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
|
||||
@@ -367,7 +367,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 3;
|
||||
CURRENT_PROJECT_VERSION = 5;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -415,7 +415,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 3;
|
||||
CURRENT_PROJECT_VERSION = 5;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
@@ -443,7 +443,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 3;
|
||||
DYLIB_CURRENT_VERSION = 5;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = FileBrowser/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
@@ -462,7 +462,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 3;
|
||||
DYLIB_CURRENT_VERSION = 5;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = FileBrowser/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
|
||||
@@ -16,6 +16,8 @@ public class FBFile: NSObject {
|
||||
public let isDirectory: Bool
|
||||
/// File extension.
|
||||
public let fileExtension: String?
|
||||
/// File attributes (including size, creation date etc).
|
||||
public let fileAttributes: NSDictionary?
|
||||
/// NSURL file path.
|
||||
public let filePath: NSURL
|
||||
// FBFileType
|
||||
@@ -29,30 +31,25 @@ public class FBFile: NSObject {
|
||||
- returns: FBFile object.
|
||||
*/
|
||||
init(filePath: NSURL) {
|
||||
var displayName = filePath.lastPathComponent
|
||||
self.filePath = filePath
|
||||
let isDirectory = checkDirectory(filePath)
|
||||
self.isDirectory = isDirectory
|
||||
if self.isDirectory {
|
||||
self.fileAttributes = nil
|
||||
self.fileExtension = nil
|
||||
self.type = .Directory
|
||||
}
|
||||
else {
|
||||
self.fileExtension = self.filePath.pathExtension
|
||||
self.fileAttributes = getFileAttributes(self.filePath)
|
||||
self.fileExtension = filePath.pathExtension
|
||||
if let fileExtension = fileExtension {
|
||||
self.type = FBFileType(rawValue: fileExtension) ?? .Default
|
||||
displayName = displayName?.stringByReplacingOccurrencesOfString(".\(fileExtension)", withString: "")
|
||||
}
|
||||
else {
|
||||
self.type = .Default
|
||||
}
|
||||
}
|
||||
if let displayName = displayName {
|
||||
self.displayName = displayName
|
||||
}
|
||||
else {
|
||||
self.displayName = String()
|
||||
}
|
||||
self.displayName = filePath.lastPathComponent ?? String()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,3 +115,15 @@ func checkDirectory(filePath: NSURL) -> Bool {
|
||||
catch { }
|
||||
return isDirectory
|
||||
}
|
||||
|
||||
func getFileAttributes(filePath: NSURL) -> NSDictionary? {
|
||||
guard let path = filePath.path else {
|
||||
return nil
|
||||
}
|
||||
let fileManager = FileParser.sharedInstance.fileManager
|
||||
do {
|
||||
let attributes = try fileManager.attributesOfItemAtPath(path) as NSDictionary
|
||||
return attributes
|
||||
} catch {}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class FileListViewController: UIViewController {
|
||||
searchController.delegate = self
|
||||
|
||||
// Add dismiss button
|
||||
let dismissButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: "dismiss")
|
||||
let dismissButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(FileListViewController.dismiss))
|
||||
self.navigationItem.rightBarButtonItem = dismissButton
|
||||
|
||||
}
|
||||
@@ -96,7 +96,7 @@ class FileListViewController: UIViewController {
|
||||
//MARK: Data
|
||||
|
||||
func indexFiles() {
|
||||
let selector: Selector = "displayName"
|
||||
let selector: Selector = Selector("displayName")
|
||||
sections = Array(count: collation.sectionTitles.count, repeatedValue: [])
|
||||
if let sortedObjects = collation.sortedArrayFromArray(files, collationStringSelector: selector) as? [FBFile]{
|
||||
for object in sortedObjects {
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.1</string>
|
||||
<string>0.1.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3</string>
|
||||
<string>5</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
|
||||
@@ -28,7 +28,7 @@ class WebviewPreviewViewContoller: UIViewController {
|
||||
self.view.addSubview(webView)
|
||||
|
||||
// Add share button
|
||||
let shareButton = UIBarButtonItem(barButtonSystemItem: .Action, target: self, action: "shareFile")
|
||||
let shareButton = UIBarButtonItem(barButtonSystemItem: .Action, target: self, action: #selector(WebviewPreviewViewContoller.shareFile))
|
||||
self.navigationItem.rightBarButtonItem = shareButton
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class FileBrowserTests: XCTestCase {
|
||||
let directoryPath = NSBundle(forClass: FileBrowserTests.self).bundleURL
|
||||
let directoryContents = parser.filesForDirectory(directoryPath)
|
||||
XCTAssertTrue(directoryContents.count > 0)
|
||||
let stitchFile = directoryContents.filter({$0.displayName == "Stitch"}).first
|
||||
let stitchFile = directoryContents.filter({$0.displayName == "Stitch.jpg"}).first
|
||||
XCTAssertNotNil(stitchFile)
|
||||
if let stitchFile = stitchFile {
|
||||
XCTAssertEqual(stitchFile.type, FBFileType.JPG)
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.1</string>
|
||||
<string>0.1.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3</string>
|
||||
<string>5</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -13,7 +13,7 @@ iOS Finder-style file browser in Swift with search, file previews and 3D touch.
|
||||
|
||||
| Features
|
||||
--------------------------|------------------------------------------------------------
|
||||
:iphone: | Browse files and folders with a familiar UI on iOS.
|
||||
:iphone: | Browse and select files and folders with a familiar UI on iOS.
|
||||
:mag: | Pull down to search.
|
||||
:eyeglasses: | Preview most file types. Including plist and json.
|
||||
:point_up_2: | 3D touch support for faster previews with Peek & Pop.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# **** Update me when new Xcode versions are released! ****
|
||||
PLATFORM="platform=iOS Simulator,OS=9.2,name=iPhone 6"
|
||||
SDK="iphonesimulator9.2"
|
||||
SDK="iphonesimulator9.3"
|
||||
|
||||
|
||||
# It is pitch black.
|
||||
@@ -19,7 +19,7 @@ MODE="$1"
|
||||
|
||||
if [ "$MODE" = "framework" ]; then
|
||||
echo "Building and testing FileBrowser."
|
||||
xctool \
|
||||
xcodebuild \
|
||||
-project FileBrowser.xcodeproj \
|
||||
-scheme FileBrowser \
|
||||
-sdk "$SDK" \
|
||||
@@ -35,7 +35,7 @@ if [ "$MODE" = "examples" ]; then
|
||||
for example in examples/*/; do
|
||||
echo "Building $example."
|
||||
pod install --project-directory=$example
|
||||
xctool \
|
||||
xcodebuild \
|
||||
-workspace "${example}Sample.xcworkspace" \
|
||||
-scheme Sample \
|
||||
-sdk "$SDK" \
|
||||
|
||||
Reference in New Issue
Block a user