---
title: "SKIndexOpenWithData(_:_:)"
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.3+]
path: coreservices/1446398-skindexopenwithdata
---

# SKIndexOpenWithData(_:_:)

Opens an existing, named index for searching only.

## Declaration

```swift
func SKIndexOpenWithData(_ inData: CFData!, _ inIndexName: CFString!) -> Unmanaged<SKIndex>!
```

## Parameters

- `inData`: The index to open.
- `inIndexName`: The name of the index. Can be NULL, in which case this function attempts to open the index with the default name of IADefaultIndex.

## Return Value

Return Value  The named index, or NULL on failure.

## Discussion

Discussion An index opened by SKIndexOpenWithData can be searched but not updated. To open an index for updating, use SKIndexOpenWithMutableData(_:_:). If inIndexName is NULL and inData does not contain an index with the default name, this function returns NULL. Search Kit is thread-safe. You can use separate indexing and searching threads. Your application is responsible for ensuring that no more than one process is open at a time for writing to an index. A call to SKIndexOpenWithData retains the opened index. When your application no longer needs the index, dispose of it by calling SKIndexClose(_:). Special Considerations You cannot use CFMakeCollectable with SKIndex objects.

## See Also

### Creating, Opening, and Closing Indexes

- [SKIndexCreateWithURL(_:_:_:_:)](coreservices/1446111-skindexcreatewithurl.md)
- [SKIndexCreateWithMutableData(_:_:_:_:)](coreservices/1447500-skindexcreatewithmutabledata.md)
- [SKIndexOpenWithMutableData(_:_:)](coreservices/1444201-skindexopenwithmutabledata.md)
- [SKIndexOpenWithURL(_:_:_:)](coreservices/1449017-skindexopenwithurl.md)
- [SKIndexClose(_:)](coreservices/1442401-skindexclose.md)
- [SKIndexGetIndexType(_:)](coreservices/1442236-skindexgetindextype.md)
- [SKIndexGetTypeID()](coreservices/1450223-skindexgettypeid.md)
