This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getFolderID( | |
name: String, | |
service: GTLRDriveService, | |
user: GIDGoogleUser, | |
completion: @escaping (String?) -> Void) { | |
let query = GTLRDriveQuery_FilesList.query() | |
// Comma-separated list of areas the search applies to. E.g., appDataFolder, photos, drive. | |
query.spaces = "drive" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func createFolder( | |
name: String, | |
service: GTLRDriveService, | |
completion: @escaping (String) -> Void) { | |
let folder = GTLRDrive_File() | |
folder.mimeType = "application/vnd.google-apps.folder" | |
folder.name = name | |
// Google Drive folders are files with a special MIME-type. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func uploadFile( | |
name: String, | |
folderID: String, | |
fileURL: URL, | |
mimeType: String, | |
service: GTLRDriveService) { | |
let file = GTLRDrive_File() | |
file.name = name | |
file.parents = [folderID] |
OlderNewer