<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVAssetResourceLoaderDelegate/resourceLoader(_:shouldWaitForLoadingOfRequestedResource:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(pl)AVAssetResourceLoaderDelegate(im)resourceLoader:shouldWaitForLoadingOfRequestedResource:"
  },
  "title" : "resourceLoader(_:shouldWaitForLoadingOfRequestedResource:)"
}
-->

# resourceLoader(_:shouldWaitForLoadingOfRequestedResource:)

Asks the delegate if it wants to load the requested resource.

```
optional func resourceLoader(_ resourceLoader: AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) -> Bool
```

## Parameters

`resourceLoader`

The resource loader object that is making the request.

`loadingRequest`

The loading request object that contains information about the requested resource.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if your delegate can load the resource specified by the `loadingRequest` parameter or <doc://com.apple.documentation/documentation/Swift/false> if it cannot.

## Discussion

The resource loader object calls this method when assistance is required of your code to load the specified resource. For example, the resource loader might call this method to load decryption keys that have been specified using a custom URL scheme.

Returning <doc://com.apple.documentation/documentation/Swift/true> from this method, implies only that the receiver will load, or at least attempt to load, the resource. In some implementations, the actual work of loading the resource might be initiated on another thread, running asynchronously to the resource loading delegate; whether the work begins immediately or merely soon is an implementation detail of the client application.

You can load the resource synchronously or asynchronously. In both cases, you must indicate success or failure of the operation by calling the [`finishLoading(with:data:redirect:)`](/documentation/AVFoundation/AVAssetResourceLoadingRequest/finishLoading(with:data:redirect:)) or [`finishLoading(with:)`](/documentation/AVFoundation/AVAssetResourceLoadingRequest/finishLoading(with:)) method of the request object when you finish. If you load the resource asynchronously, you must also store a strong reference to the object in the `loadingRequest` parameter before returning from this method.

If you return <doc://com.apple.documentation/documentation/Swift/false> from this method, the resource loader treats the loading of the resource as having failed.

---

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)