Google has a sample application on Github: https://github.com/google/google-api-objectivec-client-for-rest
If you dig an application, there is an Objective-C example of creating an event, it should also give you a good place for Swift:
- (void)addEvent:(GTLRCalendar_Event *)event { GTLRCalendarService *service = self.calendarService; GTLRCalendar_CalendarListEntry *selectedCalendar = [self selectedCalendarListEntry]; NSString *calendarID = selectedCalendar.identifier; GTLRCalendarQuery_EventsInsert *query = [GTLRCalendarQuery_EventsInsert queryWithObject:event calendarId:calendarID]; self.editEventTicket = [service executeQuery:query completionHandler:^(GTLRServiceTicket *callbackTicket, GTLRCalendar_Event *event, NSError *callbackError) { // Callback self.editEventTicket = nil; if (callbackError == nil) { [self displayAlert:@"Event Added" format:@"Added event \"%@\"", event.summary]; [self fetchSelectedCalendar]; } else { [self displayAlert:@"Add failed" format:@"Event add failed: %@", callbackError]; } }]; }
In addition, you can also use EventKit and let the user synchronize their calendar as they wish, as described here: ios Add an event to Google Calendar
source share