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

onDrop(of:isTargeted:perform:)

Defines the destination for a drag and drop operation, using the same size and position as this view, handling dropped content with the given closure. ドラッグアンドドロップ操作に対する行き先を定義します、このビューと同じ大きさと位置を使います、ドロップされた内容をこの与えられたクロージャで取り扱います。

Declaration 宣言

func onDrop(of supportedTypes: [String], 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 パラメータ

supportedTypes

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 supportedTypes. Return true if the drop operation was successful; otherwise, return false. あるクロージャ、それはドロップされた内容を取り、そして適切に応答するものです。actionへのパラメータは、supportedTypesで指定された型をもつ、ドロップされた項目いくつかを含みます。trueを返します、もしドロップ操作が上手くいったならば;そうでなければ、falseを返します。

See Also 参照

Input and Events Modifiers