Instance Method インスタンスメソッド

fileMover(isPresented:files:onCompletion:)

Presents a system interface for allowing the user to move a collection of existing files to a new location. 既存のファイルそれらからなるあるコレクションを新しい場所に移動することをユーザに許可するためのシステムインターフェイスを提示します。

Declaration 宣言

func fileMover<C>(isPresented: Binding<Bool>, files: C, onCompletion: @escaping (Result<[URL], Error>) -> Void) -> some View where C : Collection, C.Element == URL

Parameters パラメータ

isPresented

A binding to whether the interface should be shown. インターフェイスが示されるべきかどうかへのあるバインディング。

files

A collection of URLs for the files to be moved. 移動するファイルに対するURLいくつかからなるあるコレクション。

onCompletion

A callback that will be invoked when the operation has has succeeded or failed. あるコールバック、それは操作が成功したまたは失敗した時に発動されます。

result 結果

A Result indicating whether the operation succeeded or failed. あるResult、操作が成功したか失敗したかを指し示しています。

Discussion 議論

In order for the interface to appear, both isPresented must be true and files must not be empty. When the operation is finished, isPresented will be set to false before onCompletion is called. If the user cancels the operation, isPresented will be set to false and onCompletion will not be called. インターフェイスが現れるようにするために、isPresentedtrueでなければならない、そしてfilesは空であってはならない、両方が必要です。操作が終了した場合、isPresentedfalseに設定されるでしょう、onCompletionが呼び出される前に。ユーザが操作を取り消すならば、isPresentedfalseに設定されます、そしてonCompletionは呼び出されません。