functionNames(completionHandler:)
The list of function names in the model asset.
Declaration
func functionNames(completionHandler handler: @escaping @Sendable ([String]?, (any Error)?) -> Void)var functionNames: [String] { get async throws }Discussion
Some model types (e.g. ML Program) supports multiple functions. Use this method to query the function names.
The method vends the empty array when the model doesn’t use the multi-function configuration.
let modelAsset = try MLModelAsset(url: modelURL)
let functionNames = try await modelAsset.functionNames
print(functionNames) // For example, ["my_function1", "my_function2"];