https://github.com/tuist/filesystem
📁 A platform-agnostic Swift Package to interact with the file system
https://github.com/tuist/filesystem
fs swift tuist
Last synced: about 2 months ago
JSON representation
📁 A platform-agnostic Swift Package to interact with the file system
- Host: GitHub
- URL: https://github.com/tuist/filesystem
- Owner: tuist
- License: mit
- Created: 2024-04-27T14:05:33.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-04-10T20:48:10.000Z (2 months ago)
- Last Synced: 2026-04-10T22:23:01.311Z (2 months ago)
- Topics: fs, swift, tuist
- Language: Swift
- Homepage:
- Size: 1.39 MB
- Stars: 56
- Watchers: 1
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# FileSystem
FileSystem is a Swift Package that provides a simple cross-platform API to interact with the file system.
## Motivation
Why build a Swift Package for interacting with the file system if there's already `FileManager`? Here are the motivations:
- Providing human-friendly errors that are ok to present to the user.
- Integrating with [swift-log](https://github.com/apple/swift-log) to give consumers the ability to log file system operations.
- Embracing Swift's structured concurrency with async/await.
- Providing an API where paths are always absolute, makes it easier to reason about the file system operations.
> [!NOTE]
> FileSystem powers [Tuist](https://tuist.io), a toolchain to build better apps faster.
## Add it to your project
### Swift Package Manager
You can edit your project's `Package.swift` and add `FileSystem` as a dependency:
```swift
import PackageDescription
let package = Package(
name: "MyProject",
dependencies: [
.package(url: "https://github.com/tuist/FileSystem.git", .upToNextMajor(from: "0.1.0"))
],
targets: [
.target(name: "MyProject",
dependencies: ["FileSystem", .product(name: "FileSystem", package: "FileSystem")]),
]
)
```
### Tuist
First, you'll have to add the `FileSystem` package to your project's `Package.swift` file:
```swift
import PackageDescription
let package = Package(
name: "MyProject",
dependencies: [
.package(url: "https://github.com/tuist/FileSystem.git", .upToNextMajor(from: "0.1.0"))
]
)
```
And then declare it as a dependency of one of your project's targets:
```swift
// Project.swift
import ProjectDescription
let project = Project(
name: "App",
organizationName: "tuist.io",
targets: [
.target(
name: "App",
destinations: [.iPhone],
product: .app,
bundleId: "io.tuist.app",
deploymentTargets: .iOS("13.0"),
infoPlist: .default,
sources: ["Targets/App/Sources/**"],
dependencies: [
.external(name: "FileSystem"),
]
),
]
)
```
## Development
### Using Tuist
1. Clone the repository: `git clone https://github.com/tuist/FileSystem.git`
2. Generate the project: `tuist generate`
### Using Swift Package Manager
1. Clone the repository: `git clone https://github.com/tuist/FileSystem.git`
2. Open the `Package.swift` with Xcode