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

onDrop(of:isTargeted:perform:)

Defines the destination of a drag-and-drop operation that handles the dropped content with a closure that you specify. あるドラッグアンドドロップ操作の行き先を定義します、それはドロップされた内容をあなた指定のクロージャで取り扱うものです。

Declaration 宣言

func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View

Return Value 戻り値

A view that provides a drop destination for a drag operation of the specified types. あるビュー、それは指定された型のドラッグ操作に対してドロップ目的地を提供するものです。

Parameters パラメータ

supportedContentTypes

The uniform type identifiers that describe the types of content this view can accept through drag and drop. If the drag and drop operation doesn’t contain any of the supported types, then this drop destination doesn’t activate and isTargeted doesn’t update. ユニホーム型識別子いくつか、それらはこのビューがドラッグ&ドロップを通して受け入れ可能な内容の型を記述します。ドラッグ&ドロップ操作がこのサポートされる型のどれも含まないならば、その時このドロップ目的地は活動的になりません、そしてisTargetedは更新しません。

isTargeted

A binding that updates when a drag and drop operation enters or exits the drop target area. The binding’s value is true when the cursor is inside the area, and false when the cursor is outside. ドラッグ&ドロップ操作がドロップ目標エリアに入るまたは出る時に更新するあるバインディング。バインディングのもつ値は、カーソルが領域内にあるならばtrue、そしてカーソルが外側にあるならばfalseです。

action

A closure that takes the dropped content and responds appropriately. あるクロージャ、それはドロップされた内容を取り、そして適切に応答するものです。 The parameter to action contains the dropped items, with types specified by supportedContentTypes. Return true if the drop operation was successful; otherwise, return false. trueを返します、もしドロップ操作が上手くいったならば;そうでなければ、falseを返します。

Discussion 議論

The drop destination is the same size and position as this view.

See Also 参照

Drag and Drop