I am making an app for my school. The school uses a Google Calendar to schedule all of their events. They would like me to implement the events from their calendar into the app.
I am using the Google Calander API. Since I will only be pulling information from one account there is no need for user authentication.
I have my API key and made sure my events on my google calendar are visible to everybody.
This is the JSON result that I am presented with upon running.
Here is the code in my HomeController
override func viewDidLoad() {
super.viewDidLoad()
//Event call from Google API
let url = NSURL(string: "https://www.googleapis.com/calendar/v3/calendars/<THE EMAIL ACCOUNT>/events?maxResults=15&key=APIKey-<MY API KEY>")
let task = URLSession.shared.dataTask(with: url! as URL) {(data, response, error) in
let dataAsNSString = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
print(dataAsNSString)
}
task.resume()
}
