registeredContentTypes
TypeScriptregisteredContentTypesConformingTo(contentType: UTType): Array<UTType>Swift declarationfunc registeredContentTypes(conformingTo contentType: UTType) -> [UTType]Provide uniform type identifiers that describe file types for storage or transfer.
5 types
212 callable entries
3 skipped
99% entry coverage
Generated from iOS SDK 27.1. Availability is shown on each declaration; permissions and entitlements still apply.
UTTagClass
struct · iOS 14.0+
UTTagClass.RawValue
typealias · iOS 14.0+
UTType
struct · iOS 14.0+
UTType.ReferenceType
typealias · iOS 14.0+
UTTypeReference
class · iOS 14.0+
registeredContentTypesConformingTo(contentType: UTType): Array<UTType>Swift declarationfunc registeredContentTypes(conformingTo contentType: UTType) -> [UTType]get registeredContentTypes(): Array<UTType>Swift declarationvar registeredContentTypes: [UTType] { get }get registeredContentTypesForOpenInPlace(): Array<UTType>Swift declarationvar registeredContentTypesForOpenInPlace: [UTType] { get }appendingPathComponent(partialName: string, contentType: UTType): stringSwift declarationfunc appendingPathComponent(_ partialName: String, conformingTo contentType: UTType) -> StringappendingPathExtension(contentType: UTType): stringSwift declarationfunc appendingPathExtension(for contentType: UTType) -> StringappendingPathComponent(partialName: string, contentType: UTType): stringSwift declarationfunc appendingPathComponent(_ partialName: String, conformingTo contentType: UTType) -> URLappendingPathExtension(contentType: UTType): stringSwift declarationfunc appendingPathExtension(for contentType: UTType) -> URLget contentType(): (UTType) | nullSwift declarationvar contentType: UTType? { get }The file type of the resource.
appendPathComponent(partialName: string, contentType: UTType): voidSwift declarationmutating func appendPathComponent(_ partialName: String, conformingTo contentType: UTType)Generate a path component based on a partial filename and a file type, then append it to the receiver. - Parameters: - partialName: The partial filename that should be expanded upon, e.g. `"readme"`. - contentType: The type the resulting file should conform to, e.g. `.plainText`. Use this method when you have partial input from a user or other source and need to produce a complete filename suitable for that input. For example, if you are downloading a file from the Internet and know its MIME type, you can use this method to ensure the correct filename extension is applied to the URL where you save the file. If `partialName` already has a path extension, and that path extension is valid for file system objects of type `contentType`, no additional extension is appended to the path component before appending it to the URL. For example, if the inputs are `"puppy.jpg"` and `.image` respectively, then the URL will have a path component of `"puppy.jpg"` appended to it. On the other hand, if the inputs are `"puppy.jpg"` and `.plainText` respectively, the URL will have a path component of `"puppy.jpg.txt"` appended to it. If you want to ensure any existing path extension is replaced, you can use the `deletePathExtension()` method first. If the path component could not be appended, `self` is not modified. - Note: The modified URL has a directory path if `contentType` conforms to `.directory`.
appendPathExtension(contentType: UTType): voidSwift declarationmutating func appendPathExtension(for contentType: UTType)Generate a path component based on the last path component of the receiver and a file type, then replace the receiver's last path component with it. - Parameters: - contentType: The type the resulting file should conform to, e.g. `.plainText`. Use this method when you have partial input from a user or other source and need to produce a complete filename suitable for that input. For example, if you are downloading a file from the Internet and know its MIME type, you can use this method to ensure the correct filename extension is applied to the URL where you save the file. If the receiver already has a path extension, and that path extension is valid for file system objects of type `contentType`, no additional extension is appended to URL. For example, if the inputs are `"puppy.jpg"` and `.image` respectively, then the resulting URL's last path component will equal `"puppy.jpg"`. On the other hand, if the inputs are `"puppy.jpg"` and `.plainText` respectively, the resulting URL's last path component will equal `"puppy.jpg.txt"`. If you want to ensure any existing path extension is replaced, you can use the `deletePathExtension()` method first. If the path component could not be appended, `self` is not modified. - Note: The modified URL has a directory path if `contentType` conforms to `.directory`.
appendingPathComponent(partialName: string, contentType: UTType): stringSwift declarationfunc appendingPathComponent(_ partialName: String, conformingTo contentType: UTType) -> URLGenerate a path component based on a partial filename and a file type, then append it to a copy of the receiver. - Parameters: - partialName: The partial filename that should be expanded upon, e.g. `"readme"`. - contentType: The type the resulting file should conform to, e.g. `.plainText`. - Returns: A complete URL. Using the argument examples above, this method would return a URL with a last path component of `"readme.txt"`. Use this method when you have partial input from a user or other source and need to produce a complete filename suitable for that input. For example, if you are downloading a file from the Internet and know its MIME type, you can use this method to ensure the correct filename extension is applied to the URL where you save the file. If `partialName` already has a path extension, and that path extension is valid for file system objects of type `contentType`, no additional extension is appended to the path component before constructing the URL. For example, if the inputs are `"puppy.jpg"` and `.image` respectively, then the resulting URL will have a last path component of `"puppy.jpg"`. On the other hand, if the inputs are `"puppy.jpg"` and `.plainText` respectively, the resulting URL will have a last path component of `"puppy.jpg.txt"`. If you want to ensure any existing path extension is replaced, you can use the `deletingPathExtension()` method first. If the path component could not be appended, this method returns `self`. - Note: The resulting URL has a directory path if `contentType` conforms to `.directory`.
appendingPathExtension(contentType: UTType): stringSwift declarationfunc appendingPathExtension(for contentType: UTType) -> URLGenerate a path component based on the last path component of the receiver and a file type, then replace the last path component of a copy of the receiver with it. - Parameters: - contentType: The type the resulting file should conform to, e.g. `.plainText`. - Returns: A complete URL. Using the argument examples above, this method would return a URL with a last path component of `"readme.txt"`. Use this method when you have partial input from a user or other source and need to produce a complete filename suitable for that input. For example, if you are downloading a file from the Internet and know its MIME type, you can use this method to ensure the correct filename extension is applied to the URL where you save the file. If the receiver already has a path extension, and that path extension is valid for file system objects of type `contentType`, no additional extension is appended to URL. For example, if the inputs are `"puppy.jpg"` and `.image` respectively, then the resulting URL's last path component will equal `"puppy.jpg"`. On the other hand, if the inputs are `"puppy.jpg"` and `.plainText` respectively, the resulting URL's last path component will equal `"puppy.jpg.txt"`. If you want to ensure any existing path extension is replaced, you can use the `deletePathExtension()` method first. If the path component could not be appended, this method returns `self`. - Note: The resulting URL has a directory path if `contentType` conforms to `.directory`.
static init(fileURL: string, contentType?: (UTType) | null, openInPlace?: boolean, coordinated?: boolean, visibility?: _Foundation_NSItemProviderRepresentationVisibility): _Foundation_NSItemProviderSwift declarationconvenience init(contentsOf fileURL: URL, contentType: UTType?, openInPlace: Bool = false, coordinated: Bool = false, visibility: NSItemProviderRepresentationVisibility = .all)Initialize this instance with the contents of a URL The filename of the URL is copied into the `suggestedName` property. - Parameters: - fileURL: The URL of the file - contentType: The content type associated with this file, or \c nil to deduce the content type from the file extension - openInPlace: Pass `true` to allow this file to be opened in place, or `false` to have this file copied. - coordinated: Pass `true` to use file coordination to access this file, even if it is not opened in place. If `openInPlace` is set to `true`, file coordination will be used and this parameter is ignored.
loadDataRepresentation(contentType: UTType, completionHandler: ((arg0: (ArrayBuffer) | null, arg1: (NativeError) | null) => void)): _Foundation_ProgressSwift declarationfunc loadDataRepresentation(for contentType: UTType, completionHandler: @escaping @Sendable (Data?, (any Error)?) -> Void) -> ProgressLoad a representation as data If the requested representation was registered as a file, a `Data` with the contents of the file will be provided. If the registered URL points to a folder, a `Data` containing a zip archive containing that folder will be provided. - Note: The completion handler may be scheduled on an arbitrary queue. - Parameters: - contentType: Content type of the representation to load. Must conform to one of the content types returned by `registeredContentTypes`. - completionHandler: A block that will be called when loading is complete. It will either have a non-nil `Data` or a non-nil error. - Returns: A progress object. Use it to monitor loading progress, or to cancel loading.
loadFileRepresentation(contentType: UTType, openInPlace: boolean, completionHandler: ((arg0: (string) | null, arg1: boolean, arg2: (NativeError) | null) => void)): _Foundation_ProgressSwift declarationfunc loadFileRepresentation(for contentType: UTType, openInPlace: Bool = false, completionHandler: @escaping @Sendable (URL?, Bool, (any Error)?) -> Void) -> ProgressLoad a representation as a file Except for files registered as open-in-place, a temporary file containing a copy of the original will be provided to your completion handler. This temporary file will be deleted once your completion handler returns. To keep a copy of this file, move or copy it into another directory before returning from the completion handler. If the representation was registered as `Data`, its contents will be written to a temporary file. If `suggestedName` is non-nil, an attempt will be made to use it as the file name, with an appropriate file extension based on the content type. Otherwise, a suitable name and file extension will be chosen based on the content type. - Note: The completion handler may be scheduled on an arbitrary queue. - Parameters: - contentType: Content type of the representation to load. Must conform to one of the content types returned by `registeredContentTypes`. - openInPlace: Pass `true` to attempt to open a file representation in place. - completionHandler: A block that will be called when loading is complete. It will either have a non-nil `URL` or a non-nill error. The `openInPlace` parameter will be set to `true` if the file was successfully opened in place, or `false if a copy of the file was created in a temporary directory. - Returns: A progress object. Use it to monitor loading progress, or to cancel loading.
3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
NSItemProvider.registerDataRepresentation(for:visibility:loadHandler:)
callback cannot propagate synchronous failure
NSItemProvider.registerFileRepresentation(for:visibility:openInPlace:loadHandler:)
callback cannot propagate synchronous failure
UTTypeReference.init()
inherited init: cannot prove legal (class declares 16 custom initializers)