Building a passthrough file system
At a glance
| Item | Summary |
|---|---|
| Purpose | Expose an existing path as its own file system by using the FSKit framework. |
| App architecture | A Swift sample bundle with entry-bearing project variants Passthrough, PassthroughAppEx, each leading to FSKit APIs. |
| Main patterns | No named application pattern supported by the extracted structure |
| Project style | 7 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries. |
| Execution model | Source-visible boundaries: DispatchQueue(label:); none alone proves a background thread. |
| State/event model | No structured observation or publisher-scheduling marker indexed. |
| Key frameworks/packages | Foundation, FSKit, ExtensionFoundation, OSLog, SwiftUI; these are source dependencies, not architecture labels. |
Project structure
Source bundle/
├── Passthrough/
│ ├── PassthroughApp.swift
│ ├── ContentView.swift
│ └── Passthrough.entitlements
├── PassthroughAppEx/
│ ├── PassthroughAppEx.swift
│ ├── PassthroughFileSystem.swift
│ ├── PassthroughFSItem.swift
│ ├── PassthroughFSVolume+FSVolumeOperations.swift
│ ├── PassthroughFSVolume.swift
│ └── Info.plist
├── Configuration/
│ └── SampleCode.xcconfig
└── Passthrough.xcodeproj/
├── .xcodesamplecode.plist
└── project.pbxproj
Structure observations
- Architecturally prominent files are ranked from entry points and role-named declarations; resource-only paths are omitted.
- Primary languages: Swift.
- The verified tree contains 6 project/configuration file(s) and 8 source declaration(s).
Overall architecture
flowchart LR
Bundle["Sample bundle"]
V1["Passthrough"]
V2["PassthroughAppEx"]
Boundary["FSKit APIs"]
Bundle --> V1
V1 --> Boundary
Bundle --> V2
V2 --> Boundary
Reference code
Passthrough/PassthroughApp.swift:10 — architecture anchor
@main
struct PassthroughApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}Interpretation
The branches represent separate entry-bearing project variants in the downloaded bundle, not runtime calls between those variants. Each branch is intentionally collapsed at the documented framework boundary; the detailed target-local flow remains in the cited files. Ownership is claimed only where the next section cites a stored property or assignment.
Ownership and state
classDiagram
PassthroughFileSystem *-- Logger : passthroughfs
PassthroughFileSystem o-- FSPathURLResource : resource
PassthroughFileSystem o-- Containerstatus : containerStatus
PassthroughFSItem *-- Int32 : fileDescriptor
Ownership evidence
PassthroughAppEx/PassthroughFileSystem.swift:12 — stored dependency or nearest verified ownership anchor
extension Logger {
static let passthroughfs = Logger(subsystem: "com.apple.fskit.PassthroughFS", category: "default")
}| Owner | Object or state | Relationship | Mutation authority |
|---|---|---|---|
PassthroughFileSystem |
Logger (passthroughfs) |
creates and retains | Initialized by the owner; the binding is immutable |
PassthroughFileSystem |
FSPathURLResource (resource) |
stores or receives | App/module collaborators |
PassthroughFileSystem |
Containerstatus (containerStatus) |
stores or receives | App/module collaborators |
PassthroughFSItem |
Int32 (fileDescriptor) |
owns value state | App/module collaborators |
Composition arrows indicate a source-visible construction expression or locally owned value state; aggregation means the owner stores or receives a dependency without proving exclusive lifetime ownership.
Concurrency, scheduling, and thread safety
Evidence limit: actor isolation, async/await, or Task creation does not by itself prove background-thread execution; Sendable conformance alone does not prove thread-safe mutation.
| Concern | Source mechanism | Verified placement or handoff | Evidence |
|---|---|---|---|
| Queue scheduling | DispatchQueue(label:) |
The source constructs a dispatch queue; its label alone does not prove a thread. | PassthroughAppEx/PassthroughFSItem.swift:54 |
@MainActor/MainActor.run, DispatchQueue.main, and RunLoop.main are reported as distinct isolation, queue, and event-loop mechanisms. A plain Task is kept separate from Task.detached; neither is labeled as a background thread.
Reference code
PassthroughAppEx/PassthroughFSItem.swift:54 — representative execution boundary
class PassthroughFSItem: FSItem {
// ...
self.openModeQueue = DispatchQueue(label: "com.apple.fskit.passthroughfs.item.\(name).openmode.queue")
// ...
}State propagation, frameworks, and dependencies
Evidence limit: an import proves a source-level compilation dependency at the cited line; it does not prove runtime use, architectural adoption, or whether a Swift package is a direct application dependency.
| Category | Mechanism or module | Verified role | Evidence |
|---|---|---|---|
| Source import | Foundation |
The cited file imports this module; runtime use and architectural role are not inferred. | PassthroughAppEx/PassthroughAppEx.swift:9 |
| Source import | FSKit |
The cited file imports this module; runtime use and architectural role are not inferred. | PassthroughAppEx/PassthroughAppEx.swift:10 |
| Source import | ExtensionFoundation |
The cited file imports this module; runtime use and architectural role are not inferred. | PassthroughAppEx/PassthroughFSItem.swift:9 |
| Source import | OSLog |
The cited file imports this module; runtime use and architectural role are not inferred. | PassthroughAppEx/PassthroughFSItem.swift:11 |
| Source import | SwiftUI |
The cited file imports this module; runtime use and architectural role are not inferred. | Passthrough/ContentView.swift:8 |
receive(on:) describes downstream delivery scheduling, while subscribe(on:) describes upstream subscription/request/cancel scheduling. An import Combine alone establishes neither behavior nor a Store, reducer, Redux, or other application architecture.
Class and protocol design
Passthrough/PassthroughApp.swift:11 — representative type boundary
@main
struct PassthroughApp: App {
// ...
ContentView()
// ...
}| Type | Responsibility | Depends on or conforms to |
|---|---|---|
PassthroughApp |
Application entry and top-level composition | App |
ContentView |
User-interface presentation and input forwarding | View |
PassthroughFileSystem |
Runs entity-component-system update logic | FSUnaryFileSystem & FSUnaryFileSystemOperations |
PassthroughAppEx |
Represents a feature value or composable behavior | UnaryFileSystemExtension |
PassthroughFSItemOpenMode |
Defines a closed set of feature states or choices | Int32 |
PassthroughFSItem |
Represents feature data | FSItem |
CommonAttributes |
Represents a feature value or composable behavior | Concrete collaborators/imported frameworks |
PassthroughFSVolume |
Owns feature behavior and collaborator lifecycle | FSVolume |
No local protocol conformance is claimed as protocol-oriented design; external framework conformances are listed only as dependencies.
Access control
| Symbol | Access | Verified effect | Likely rationale |
|---|---|---|---|
initInode (PassthroughAppEx/PassthroughFSItem.swift:79) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: hide an implementation step that is not part of the collaboration surface. |
openWithMode (PassthroughAppEx/PassthroughFSItem.swift:90) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: hide an implementation step that is not part of the collaboration surface. |
volumeStatistics (PassthroughAppEx/PassthroughFSVolume+FSVolumeOperations.swift:33) |
public |
The symbol is visible to importing modules. | Inference: make the declaration available across a module or target boundary. |
activate (PassthroughAppEx/PassthroughFSVolume+FSVolumeOperations.swift:57) |
public |
The symbol is visible to importing modules. | Inference: make the declaration available across a module or target boundary. |
Reference code
PassthroughAppEx/PassthroughFSItem.swift:79 — representative boundary
private func initInode() throws {
var statResult = stat()
_ = try throwErrno { fstat(self.fileDescriptor, &statResult) }
self.inode = statResult.st_ino
}Swift declarations without a modifier are internal; explicit private, fileprivate, private(set), public, or open entries above are interpreted by language semantics. Objective-C/C samples instead rely on header and implementation boundaries, which are not equivalent to Swift lexical privacy.
Logic ownership and placement
| Logic | Owning type or file | Placement rationale |
|---|---|---|
| Application entry and top-level composition | PassthroughApp |
The source’s App suffix makes this role explicit. |
| Runs entity-component-system update logic | PassthroughFileSystem |
The source’s System suffix makes this role explicit. |
| User-interface presentation and input forwarding | ContentView |
The source’s View suffix makes this role explicit. |
Design patterns
| Pattern | Source evidence | Purpose or tradeoff |
|---|---|---|
| No named application pattern | Passthrough/PassthroughApp.swift:10 |
The verified source directly composes concrete framework types; this document avoids forcing a pattern name. |
Naming conventions
- Types: App: PassthroughApp; System: PassthroughFileSystem; View: ContentView.
- Protocols: no local protocol declaration in the scanned source.
- Methods:
throwErrno,createVolumeNameFromPath,loadResource,unloadResource,probeResource,initInode,openWithMode,upgradeOpenMode. - Files:
Passthrough/PassthroughApp.swift,PassthroughAppEx/PassthroughAppEx.swift,Passthrough/ContentView.swift,PassthroughAppEx/PassthroughFileSystem.swift,PassthroughAppEx/PassthroughFSItem.swift,PassthroughAppEx/PassthroughFSVolume.swift.
Architecture takeaways
PassthroughAppis the main source-visible entry or composition anchor for this sample.- Framework work reaches FSKit, ExtensionFoundation, SwiftUI through a deliberately small high-level chain; the detailed API graph remains inside the cited implementation files.
- Stored-property evidence identifies lifecycle collaboration; it does not by itself prove exclusive object ownership.
- Access-control conclusions separate verified language visibility from the likely design rationale.
- The source does not justify labeling the design protocol-oriented.
Source map
| Source file | Relevant symbols |
|---|---|
Passthrough/PassthroughApp.swift |
Cited implementation, PassthroughApp |
PassthroughAppEx/PassthroughFileSystem.swift |
Cited implementation, PassthroughFileSystem |
PassthroughAppEx/PassthroughFSItem.swift |
Cited implementation, DispatchQueue(label:), ExtensionFoundation, OSLog, PassthroughFSItemOpenMode, PassthroughFSItem |
PassthroughAppEx/PassthroughFSVolume+FSVolumeOperations.swift |
Cited implementation, CommonAttributes |
PassthroughAppEx/PassthroughAppEx.swift |
Foundation, FSKit, PassthroughAppEx |
Passthrough/ContentView.swift |
SwiftUI, ContentView |
PassthroughAppEx/PassthroughFSVolume.swift |
PassthroughFSVolume |