<!--
{
  "availability" : [
    "macOS: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSUnaryFileSystemOperations/loadResource(resource:options:replyHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(pl)FSUnaryFileSystemOperations(im)loadResource:options:replyHandler:"
  },
  "title" : "loadResource(resource:options:replyHandler:)"
}
-->

# loadResource(resource:options:replyHandler:)

Requests that the file system load a resource and present it as a volume.

```
func loadResource(resource: FSResource, options: FSTaskOptions, replyHandler reply: @escaping @Sendable (FSVolume?, (any Error)?) -> Void)
```

## Parameters

`resource`

An [`FSResource`](/documentation/FSKit/FSResource) to load.

`options`

An [`FSTaskOptions`](/documentation/FSKit/FSTaskOptions) object specifying options to apply when loading the resource. An [`FSUnaryFileSystem`](/documentation/FSKit/FSUnaryFileSystem) supports two options: `-f` for “force” and `--rdonly` for read-only. The file system must remember if the read-only option is present.

`reply`

A block or closure that your implementation invokes when it finishes setting up or encounters an error. Pass a subclass of `FSVolume` as the first parameter if loading succeeds. If loading fails, pass an error as the second parameter.

## Discussion

Implement this method by inspecting the provided resource and verifying it uses a supported format.
If the resource does use a supported format, create a subclass of `FSVolume`, clear the container error state, and invoke the `reply` callback, passing your volume as a parameter.
If loading can’t proceed, invoke `reply` and send an appropriate error as the second parameter.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)