<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/AnnotatedFiles",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents14AnnotatedFilesV"
  },
  "title" : "AnnotatedFiles"
}
-->

# AnnotatedFiles

An annotated files collection.

```
struct AnnotatedFiles
```

## Topics

### Creating the feature

[`init(labeledBySubdirectoryNamesAt: URL, type: UTType, continueOnFailure: Bool) throws`](/documentation/CreateMLComponents/AnnotatedFiles/init(labeledBySubdirectoryNamesAt:type:continueOnFailure:))

Reads training examples from a directory containing files in labeled sub-directories.

[`init(labeledByNamesAt: URL, separator: Character, index: Int, type: UTType, continueOnFailure: Bool) throws`](/documentation/CreateMLComponents/AnnotatedFiles/init(labeledByNamesAt:separator:index:type:continueOnFailure:))

Reads training examples from a directory containing files having their labels in the name.
The name can contain multiple words separated by a `separator`. So the `index` tells the
position of the label in the file name.
Files with incorrect name format are ignored.

## Relationships

### Conforms To

[`Escapable`](/documentation/Swift/Escapable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Encodable`](/documentation/Swift/Encodable)

[`Equatable`](/documentation/Swift/Equatable)

[`Decodable`](/documentation/Swift/Decodable)

[`Sequence`](/documentation/Swift/Sequence)

[`Collection`](/documentation/Swift/Collection)

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

[`Copyable`](/documentation/Swift/Copyable)

---

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)