---
title: "beginAccessingModelCollectionWithIdentifier:completionHandler:"
framework: Core ML
role: symbol
role_heading: Type Method
platforms: [visionOS 1.0+]
path: "coreml/mlmodelcollection/beginaccessingmodelcollectionwithidentifier:completionhandler:"
---

# beginAccessingModelCollectionWithIdentifier:completionHandler:

Requests access to a model collection.

## Declaration

```occ
+ (NSProgress *) beginAccessingModelCollectionWithIdentifier:(NSString *) identifier completionHandler:(void (^)(MLModelCollection *modelCollection, NSError *error)) completionHandler;
```

## Parameters

- `identifier`: The name of the model collection.
- `completionHandler`: In Objective-C, the block that Core ML calls when the model collections is available to your app. The block has the following parameters:

## Discussion

Discussion Use this method to access a model collection from a deployment (see Creating and Deploying a Model Collection). Your app can call this method multiple times, typically each time it needs to access the models in the collection. Core ML calls your completion app’s completion handler once the entire collection is on the user’s device. If the model collection isn’t already on the user’s device, Core ML immediately begins fetching it over the network. func modelCollectionAvailable(result: Result<MLModelCollection, Error>) {     switch result {     case .success(let collection):         print("Model collection `\(collection.identifier)` is now available.")                  // Load a model from the collection.         loadModel("DeploymentModel", from: collection)              case .failure(let error):         print("Error accessing a model collection: \(error)")     } } Once your app has the model collection, use the model’s identifier that you assigned it in the deployment (see Creating and Deploying a Model Collection). Create an instance of a collection’s model by passing its entry’s modelURL — from the model collection’s entries property — to the load(contentsOf:configuration:completionHandler:) class method. tip: Use a default model from your app’s bundle while your app waits for the model collection. When your app gets the model collection, switch to the collection’s newer model. If your app uses a default model from the app bundle, you can use an initializer from its convenience wrapper class that Xcode automatically generated. let modelFromCollection = try? BuiltInModel(contentsOf: entry.modelURL)

## See Also

### Accessing a model collection

- [endAccessing(identifier:)](coreml/mlmodelcollection/endaccessing(identifier:).md)
