Mallow's Blog

Introduction to drag and drop in iOS 11

What is Drag and Drop?

In WWDC 2017 apple has released new API for graphically move/copy data from one place to another which is called as Drag and Drop.

Goals:
Apple have following things as goals of drag and drop to provide great user experience when user moving/copying data using drag and drop,

• Responsiveness

• Security

• Great multi-touch experience

Responsiveness:

The entire operation will be performed asynchronously and based on demand from destination app. Since the entire process is performing asynchronously the main block won’t get the block, a user can continue to do interact with the app.

Security:

There won’t be any security risk at when we are dealing with confidential data, OS will handle everything from the security point of view.  Source app can restrict dragged data like it only visible to other apps which are developed by same developer or all apps in the system.

Great multi-touch experience:

Apple fully utilized their multi touch feature in drag and drop, a user can do multi-touch to select multiple data once they picked up the first one. The interface for drag and drop is very live and it will give great visual feedback when the user activates drag action and drop action.

When dragging the data from one app to another user can hover destination app icon to navigate into it and they can navigate to the place where they want to drop their data. In addition to this user can change the drag action between their fingers and even between their hands for easy use.

Concepts:

• From iOS 11 we can drag and drop the contents from on screen location to another using the continuous gesture. We can use drag and drop between different screens in the same app and between apps too.

• In iPad, we can use the full functionality of drag and drop feature in iOS 11. In iPhone, we can use only within apps.

• The app where the drag initiating is called as source app.

• The app where the drop action takes place is called destination app.

• In iPhone the single app play as both source and destination app role, in which drag and drop action perform.

• The complete action from start to finish action is called drag activity.

• The system manages an object with the items dragging is called as drag session.

• When the drag action is performing between the apps, the source and destination apps will work as usual until its time came to act for drag and drop action. The user interaction also enabled for both source and destination apps. So a user can invoke drag and drop activity, return to home screen, open the second app in split view and the user can initiate another drag and drop action.

• Unlike macOS, iOS can drag and drop multiple contents in a single drag and drop action. For this user have to select multiple contents from single drag from source app and the destination app can handle multiple contents from single drop action. Drag and drop use the power of multi touch to drag and drop the multiple contents.

• Spring loading: With spring loading, you can use drag and drop feature to open the destination app and navigation a to place where you want to place the dragged contents.

• Text view and text field offers default drag and drop functionality. The collection view and table view offers view specific methods and property for handling drag and drop in it.

• Text view also offers apis for handling custom view drag and drop action.

• The beauty of dragging and dropping between apps in iOS is we don’t need to do code signing, configure entitlements and info.plist. The system will handle everything for us from security aspects.

• We need to register Uniform type identifiers(UTI)  in our app for accepting different content types for dropping action and providing different documents from source app, just like importing contents to our app.

• The app which allows for drag action should implement UIDragInteractionDelegate methods and the app which allowing for drop action should implement UIDropInteractionDelegate methods.

• The drag and drop can be integrated throughout the iOS and it can be used in following places

 Home screen, Dock, Reminders, Calendar, Message, Spotlight, Files, Safari, Contacts, iBooks, News, Notes, Photos, Maps, Keynotes, Pages and Numbers

• The below image will explain the roadmap of the drag and drop api.

API Roadmap

                                                                                                                           API Roadmap

These are some of the basic things about drag and drop features in iOS 11. We can see more details about drag and drop in our future posts.


Karthick S,
iOS Team,
Mallow Technologies.

Leave a Reply

%d bloggers like this: