Contents

activate(options:replyHandler:)

Activates the volume using the specified options.

Declaration

func activate(options: FSTaskOptions, replyHandler reply: @escaping  @Sendable (FSActivateResult?, (any Error)?) -> Void)
func activate(options: FSTaskOptions) async throws -> FSActivateResult

Parameters

  • options:

    Options to apply to the activation. These can include security-scoped file paths. There are no defined options currently.

  • reply:

    A block or closure to indicate success or failure. If activation succeeds, pass an instance of Fsactivateresult containing the root Fsitem, along with a nil error. If activation fails, pass the relevant error as the second parameter; FSKit ignores the Fsactivateresult instance in this case. For an async Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

Discussion

When FSKit calls this method, allocate any in-memory state required to represent the file system. Also allocate an FSItem for the root directory of the file system, and pass it to the reply block. FSKit caches this root item for the lifetime of the volume, and uses it as a starting point for all file look-ups.

Volume activation occurs prior to any call to mount the volume.

See Also

Handling activation and deactivation