You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Files 4.0
This change includes a brand new implementation for Files,
that keeps most of the public API intact, while modernizing
the underlying implementation.
Under the hood, Files now uses value types and protocols,
rather than class inheritance - which improves the type safety
of the API, and streamlines the underlying code. Error handling
is also improved to include more underlying info, and the docs
have been reworked to be much more thorough.
The API has also been fine-tuned and modernized, dropping the
`FileSystem` class in favor of more “Swifty” APIs on `Folder`,
introducing more options for creating new files and folders, and
making it possible to easily change properties on file system
sequences.
A list of all changes will be posted as part of this version’s
release notes.
- Add Files using `$ marathon add https://github.com/johnsundell/files.git`.
89
-
- Run your script using `$ marathon run <path-to-your-script>`.
89
+
Files can be easily used in either a Swift script, a command line tool, or in an app for iOS, macOS, tvOS or Linux.
90
90
91
-
### In a command line tool
91
+
### Using the Swift Package Manager (preferred)
92
92
93
-
- Drag the file `Files.swift`into your command line tool's Xcode project.
93
+
To install Files for use in a Swift Package Manager-powered tool, script or server-side application, add Files as a dependency to your `Package.swift`file. For more information, please see the [Swift Package Manager documentation](https://github.com/apple/swift-package-manager/tree/master/Documentation).
- Drag the file `Files.swift` into your application's Xcode project.
101
+
Please refer to [CocoaPods’](https://cocoapods.org) or [Carthage’s](https://github.com/Carthage/Carthage) own documentation for instructions on how to add dependencies using those tools.
100
102
101
-
or
103
+
### As a file
102
104
103
-
- Use CocoaPods, Carthage or the Swift Package manager to include Files as a dependency in your project.
105
+
Since all of Files is implemented within a single file, you can easily use it in any project by simply dragging the file `Files.swift` into your Xcode project.
104
106
105
107
## Backstory
106
108
107
109
So, why was this made? As I've migrated most of my build tools and other scripts from languages like Bash, Ruby and Python to Swift, I've found myself lacking an easy way to deal with the file system. Sure, `FileManager` has a quite nice API, but it can be quite cumbersome to use because of its string-based nature, which makes simple scripts that move or rename files quickly become quite complex.
108
110
109
-
110
111
So, I made **Files**, to enable me to quickly handle files and folders, in an expressive way. And, since I love open source, I thought - why not package it up and share it with the community? :)
0 commit comments