OpenDialog
public class OpenDialog : FileDialog
The OpenDialog
provides an interactive dialog box for users to select files or directories.
The open dialog can be used to select files for opening, it can be configured to allow
multiple items to be selected (based on the allowsMultipleSelection
) variable and
you can control whether this should allow files or directories to be selected.
To use, create an instance of OpenDialog
, and pass it to
Application.present
. When complete, the list of files will be available in the `filePaths property.
To select more than one file, users can use the spacebar, or control-t.
-
Creates a new instance of the OpenDialog
Declaration
Swift
public init(title: String = "", message: String = "")
Parameters
title
Tilte to show for the dialog
message
Additional message to display in the open dialog
-
Controls whether the open dialog can allow multiple files to be selected
Declaration
Swift
public var allowsMultipleSelection: Bool { get set }
-
Gets or sets a value indicating whether this
OpenDialog
can choose directories.Declaration
Swift
public var canChooseDirectories: Bool { get set }
-
Gets or sets a value indicating whether this
OpenDialog
can choose files.Declaration
Swift
public var canChooseFiles: Bool { get set }
-
The list of selected paths, nil if the user canceled the operation
Declaration
Swift
public var filePaths: [String]? { get }
-
Use this method to present the dialog, the callback will be invoked when the dialog is closed, probe the
canceled
variable, if it is set to true, it means that the user did cancel the dialog, otherwise the selection is on thefileName
property (that variable is nil if the user canceled as well)Declaration
Swift
public func present(_ callback: @escaping (OpenDialog) -> ())