loadResource(resource:options:replyHandler:)
Requests that the file system load a resource and present it as a volume.
Declaration
func loadResource(resource: FSResource, options: FSTaskOptions, replyHandler reply: @escaping @Sendable (FSVolume?, (any Error)?) -> Void)func loadResource(resource: FSResource, options: FSTaskOptions) async throws -> FSVolumeParameters
- resource:
An Fsresource to load.
- options:
An Fstaskoptions object specifying options to apply when loading the resource. An Fsunaryfilesystem supports two options:
-ffor “force” and--rdonlyfor 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
FSVolumeas 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.