Start a Project

How to access iCloud Drive or Google Drive Data in application using Swift 3

iCloud Drive or Google Drive

Some times we need to access the data in application like we need to upload the data to server or send to someone using the application so default iOS device provide only photo library to access but we need all types of file in one place due to this reason we need to access the google or iCloud drive.

iOS provide classes to use this functionality but respective drive application must be installed in the devices;

Follow this steps:

1: add this two delegate in class where you want to use.

like as:

2: Now create one button so you can click and access the data :

Here i have taken one button and write this code:

Note:

for documnetTypes:

Here I have mentioned only images so you have to pass all types of file extension whatever you need .

3: Now write their delegate so you can pick the selected data.

4: this delegate method will be called now, their methods definition

A: documentpicker: this method will called if have selected any file in drive then it will provide the url through which you can access the data and open in web service or share to other.

B:  documentPickerWasCancelled : when user did not select any items.

Exit mobile version