FileKit v2.0.0 Release Notes
Release Date: 2015-11-25 // over 8 years ago-
🚀 Release Notes
Important:
- The 'FK' prefix for FileKit types has been removed in an effort to make the library less cumbersome and more "Swifty" to use. 🔶
FileType
is no longer a protocol for files. It is now an enumeration of types that a given file can be. TheFile
class is now the standard form of interacting with files.
🆕 New Features
FileKit
enumeration to get info regarding the current version of FileKit🍱 tvOS support 📺
DirectoryEnumerator
struct to enumerate through the files in a directory.Settable path extension
A path's children can now be obtained recursively
let allFilesInHome = Path.UserHome.children(recursive: true)
String
andPath
concatenation with the+
operatorA
changeDirectory(_:)
toPath
that changes the process' current working
directory toself
Path.UserDesktop.changeDirectory { print(Path.Current) // "/Users/nvzqz/Desktop"}
Getting a common ancestor between two paths with the
<^>
operator andcommonAncestor(_:)
methodGetting a resolved path with the
*
postfix operatorGetting an
NSFileHandle
for aFile
orPath
Path
now conforms toSequenceType
// Prints all of the paths in the user's home directoryfor path in Path.UserHome { print(path) }
Static
readFromPath(_:)
method forReadable
types that returnsSelf
Path
now conforms toStringInterpolationConvertible
, which acts in the same way regularString
interpolation works.let filePath: Path = "~/Desktop/File \(2)"print(filePath.rawValue) // "~/Desktop/File 2"
A
find
method with a search depth that maps a function on each path found and returns the non-nil results.let documents = Path.UserDocuments.find(searchDepth: 1) { String($0) }
🎉 Initializers for
NSString
andNSBundle
that take aPath
Getting an
NSStream
for aFile
orPath
File
now conforms toComparable
according to size👀
FilePermissions
struct for seeing the permissions of the current process for a given file.let swift: Path = "/usr/bin/swift"print(swift.filePermissions) // FilePermissions[Read, Execute]
🔄 Changes
- ✂ Removed 'FK' prefix from FileKit types in an effort to make the library more Swifty
- ✂ Removed
FileType
as a protocol for filesFileType
is now an enumeration of types that a file can be.File
is now the standard way of interacting with files
- 📇 Renamed
FKError
toFileKitError
- 🔄 Changed error parameters 'fromPath' and 'toPath' to 'from' and 'to' respectively
- 🔄 Changed the
•
postfix operator to%
for standardizing path - 📇 Renamed
findPaths
method tofind
forPath
- 🔄 Changed path
url
property toURL
and made it non-optional - 0️⃣ The
find
method now has-1
as its defaultsearchDepth
writable
property forWritableConvertible
is now non-optional- 🛠 Fix
+
operator implementation