From the course: iOS Development: Architecture

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

AirDrop

AirDrop

From the course: iOS Development: Architecture

Start my 1-month free trial

AirDrop

- [Instructor] AirDrop lets us share various types of data with nearby devices. And implementing this feature is quite simple. Thanks to the UIActivityViewController, it takes only a few lines of code to add AirDrop support to our apps. Let's prove this by building an AirDrop demo app. We're going to enhance the image download test app. We add the ability to share a selected image via AirDrop. If you want to follow along with me, you can find the project in the exercise files folder. Chapter seven and the 07_07 folder begin. In the PhotosCollectionViewController file, I implement the collectionView(didSelectItemAt indexPath:) delegate method. First, we try to retrieve the item that was selected by the user. Then, we try to get the UIImage object associated with its imageView. We have to tell first the type of our cell, which should be PhotosCollectionViewCell. Alright. Now, we instantiate a UIActivityViewController object. The first argument is where we specify the object we wanna…

Contents