O'Reilly logo

Learn iOS 11 Programming with Swift 4 - Second Edition by Craig Clayton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accepting drag from other apps 

Let's get started in accepting drag and drop from other apps:

  • Add drag and drop to our photo view from Photos apps
  • Add drag and drop from filter scroller

The first thing we want to do is enable dragging for our filter items. We need to create a new extension to our PhotoFilterViewController called PhotoFilterViewController+UIDropInteraction. Inside this file, add the following:

import UIKitimport Foundationextension PhotoFilterViewController: UIDropInteractionDelegate {}

Next, we need to add all of the methods needed to accept drop interaction. We will write this to allow dropping within the app as well as outside of the app. When you start to drag an element, Apple calls this a session. There are two primary ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required