---
title: "SKIndexDocumentIteratorCreate(_:_:)"
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.3+]
path: coreservices/1446189-skindexdocumentiteratorcreate
---

# SKIndexDocumentIteratorCreate(_:_:)

Creates an index-based iterator for document URL objects (of type SKDocument) owned by a parent document URL object.

## Declaration

```swift
func SKIndexDocumentIteratorCreate(_ inIndex: SKIndex!, _ inParentDocument: SKDocument!) -> Unmanaged<SKIndexDocumentIterator>!
```

## Parameters

- `inIndex`: The index you want to iterate across.
- `inParentDocument`: The document URL object that is the parent of the document URL objects you want to examine. Pass NULL to get the top item in an index. See doc://com.apple.documentation/documentation/coreservices/skdocument for a discussion of how to get the full URL for a document URL object.

## Return Value

Return Value An index-based document iterator.

## Discussion

Discussion When you want to iterate across all the documents represented in an index, use this function to create an iterator and then call SKIndexDocumentIteratorCopyNext(_:) in turn for each document URL object (of type SKDocument) in the index. Document iterators iterate over a single level of an index. Your code is responsible for descending through a hierarchy of documents in an index. 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. When your application no longer needs the iterator, dispose of it by calling CFRelease.

## See Also

### Managing Indexes

- [SKIndexAddDocumentWithText(_:_:_:_:)](coreservices/1444518-skindexadddocumentwithtext.md)
- [SKIndexAddDocument(_:_:_:_:)](coreservices/1444897-skindexadddocument.md)
- [SKIndexFlush(_:)](coreservices/1450667-skindexflush.md)
- [SKIndexCompact(_:)](coreservices/1443628-skindexcompact.md)
- [SKIndexGetDocumentCount(_:)](coreservices/1449093-skindexgetdocumentcount.md)
- [SKIndexGetMaximumDocumentID(_:)](coreservices/1444628-skindexgetmaximumdocumentid.md)
- [SKIndexGetMaximumTermID(_:)](coreservices/1444278-skindexgetmaximumtermid.md)
- [SKIndexDocumentIteratorCopyNext(_:)](coreservices/1442212-skindexdocumentiteratorcopynext.md)
- [SKIndexDocumentIteratorGetTypeID()](coreservices/1443022-skindexdocumentiteratorgettypeid.md)
- [SKIndexGetAnalysisProperties(_:)](coreservices/1443461-skindexgetanalysisproperties.md)
- [SKIndexMoveDocument(_:_:_:)](coreservices/1449899-skindexmovedocument.md)
- [SKIndexRemoveDocument(_:_:)](coreservices/1444375-skindexremovedocument.md)
- [SKIndexRenameDocument(_:_:_:)](coreservices/1448935-skindexrenamedocument.md)
- [SKIndexSetMaximumBytesBeforeFlush(_:_:)](coreservices/1448696-skindexsetmaximumbytesbeforeflus.md)
- [SKIndexGetMaximumBytesBeforeFlush(_:)](coreservices/1445329-skindexgetmaximumbytesbeforeflus.md)
