#author("2018-05-07T13:58:18+09:00","default:wikiwriter","wikiwriter") &tag(Drag and Drop Tutorial for macOS); *目次 [#ucabbfd7] #contents *関連ページ [#qaf5514b] *参考情報 [#bc66b812] -[[Drag and Drop Tutorial for macOS:https://www.raywenderlich.com/136272/drag-and-drop-tutorial-for-macos]] -NSViewサブクラスのドラッグ&ドロップ実装 -アプリのその他のビューにドラッグできるデータを提供 -カスタムドラッグタイプ *Getting Started [#laf58f4a] -同ページからスタータープロジェクトをダウンロード。 -メインのSticker Viewは画像などをドラッグ先。 -画面下部の二つのビューはデータソース。 -Dragging DestinationとDragging Sourcesに大別できる。 -Dragging Destination --StickerBoardViewController.swift: メインビューコントローラー --DestinationView.swift: 画面上部のビュー -Dragging Source --ImageSourceView.swift: ユニコーンのイメージがついたビュー。 --AppActionSourceView.swift Sparklesというラベルがつい他ビュー *ペーストボードとドラッギングセッション [#jd409a75] -ドラッグとドロップはソースとデスティネーションが関連する。 -sourceからドラッグし、NSDraggingSourceプロトコルを実装する。 -destinationにドロップし、NSDraggingDestinationプロトコルを実装する。 -NSPasteboardはデータ交換を円滑する。