AppleFilePicker

Inherits: RefCounted < Object

Provides access to the operating system file picker, on iOS, this provides access to sandboxed content.

Description

This class provides access to the system’s native file picker (UIDocumentPickerViewController on iOS, NSOpenPanel on macOS).

It allows selecting files based on UTTypes (passed as file extensions) and supports both single and multiple file selection.

If your application is running in a sandbox (always the case on iOS, sometimes on MacOS), you need to call the AppleURL methods for starting and stopping access to them.

Methods

void

pick_document(allowed_types: Array, allow_multiple: bool)


Signals

canceled() 🔗

Emitted when the picker is canceled by the user.


file_selected(url: AppleURL, path: String) 🔗

Emitted when a single file is selected (when allow_multiple is false).


files_selected(urls: Array, paths: PackedStringArray) 🔗

Emitted when multiple files are selected (when allow_multiple is true).


Method Descriptions

void pick_document(allowed_types: Array, allow_multiple: bool) 🔗

Opens the file picker.

allowed_types should be an array of strings representing the file extensions or UTTypes you want to allow (e.g. ["txt", "png"] or ["public.plain-text"]).

allow_multiple if true, allows selecting multiple files. Results will be emitted via the files_selected signal. If false (default), results are emitted via file_selected.