One Logo Pool Ball
CreateMLComponents · IOS API REFERENCE

AnnotatedFiles

struct · iOS 16.0+ · SDK 27.1

struct AnnotatedFiles

An annotated files collection.

Members (6)

get · iOS 16.0+

startIndex

TypeScript
get startIndex(): SDKHandle
Swift declaration
var startIndex: AnnotatedFiles.Index { get }

The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.

init · iOS 16.0+

init

TypeScript
static initLabeledByNamesAtSeparatorIndexTypeContinueOnFailure(url: string, separator: string, index: number, type: _UniformTypeIdentifiers_UTType, continueOnFailure?: boolean): AnnotatedFiles
Swift declaration
init(labeledByNamesAt url: URL, separator: Character = ".", index: Int = 0, type: UTType, continueOnFailure: Bool = false) throws

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. Take for example this directory structure: / fold1-foo-file1.png fold1-foo-file2.png fold2-foo-file3.png fold1-bar-file4.png fold1-bar-file5.png fold2-bar-file6.png When we specify separator as "-" and index as 1, it would produce two labels (foo and bar) with three URLs each. - Parameters: - url: URL of directory containing the files. - separator: The separator used in the name. Default value is "." - index: Index of the label in the file name. Default value is 0. - type: Type of files. - continueOnFailure: A Boolean value indicating whether to continue reading files after encountering a file that is not readable. The default value is `false`.

init · iOS 16.0+

init

TypeScript
static initLabeledBySubdirectoryNamesAtTypeContinueOnFailure(url: string, type: _UniformTypeIdentifiers_UTType, continueOnFailure?: boolean): AnnotatedFiles
Swift declaration
init(labeledBySubdirectoryNamesAt url: URL, type: UTType, continueOnFailure: Bool = false) throws

Reads training examples from a directory containing files in labeled sub-directories. Take for example this directory structure: / foo/ file1.png file2.png bar/ file3.png file4.png It would produce two labels (foo and bar) with two URLs each. - Parameters: - url: URL of directory containing the files. - type: Type of files. - continueOnFailure: A Boolean value indicating whether to continue reading files after encountering a file that is not readable. The default value is `false`.

method · iOS 16.0+

index

TypeScript
index(i: SDKHandle): SDKHandle
Swift declaration
func index(after i: AnnotatedFiles.Index) -> AnnotatedFiles.Index

Returns the position immediately after the given index. The successor of an index must be well defined. For an index `i` into a collection `c`, calling `c.index(after: i)` returns the same index every time. - Parameter i: A valid index of the collection. `i` must be less than `endIndex`. - Returns: The index value immediately after `i`.

get · iOS 16.0+

endIndex

TypeScript
get endIndex(): SDKHandle
Swift declaration
var endIndex: AnnotatedFiles.Index { get }

The collection's "past the end" position---that is, the position one greater than the last valid subscript argument. When you need a range that includes the last element of a collection, use the half-open range operator (`..<`) with `endIndex`. The `..<` operator creates a range that doesn't include the upper bound, so it's always safe to use with `endIndex`. For example: let numbers = [10, 20, 30, 40, 50] if let index = numbers.firstIndex(of: 30) { print(numbers[index ..< numbers.endIndex]) } // Prints "[30, 40, 50]" If the collection is empty, `endIndex` is equal to `startIndex`.

subscript · iOS 16.0+

subscript

TypeScript
subscript(index: SDKHandle): SDKHandle
Swift declaration
subscript(index: AnnotatedFiles.Index) -> IndexingIterator<AnnotatedFiles>.Element { get }

Accesses the element at the specified position. The following example accesses an element of an array through its subscript to print its value: var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] print(streets[1]) // Prints "Bryant" You can subscript a collection with any valid index other than the collection's end index. The end index refers to the position one past the last element of a collection, so it doesn't correspond with an element. - Parameter position: The position of the element to access. `position` must be a valid index of the collection that is not equal to the `endIndex` property. - Complexity: O(1)

Skipped declarations

No declarations were skipped in this snapshot.

All CreateMLComponents types →