title: Google Sheets API is not working at all?
body: <p>I am working on an app right now for my work study position. I am new to iOS programming in general and have never used an API before. I have no idea what I'm doing and it doesn't help that Google's Quickstart isn't working for me either.</p>
  
  <p>I followed the Quickstart completely and now I am at a loss here. I have errors everywhere and no information to fix them. <a href="https://developers.google.com/sheets/api/quickstart/ios?ver=swift" rel="nofollow noreferrer">You can see the code here</a> and</p>
  
  <p><a href="https://i.stack.imgur.com/Z4AGk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z4AGk.jpg" alt="here is a screenshot of my code with the numerous errors."></a></p>
  
  <p>here is the code I have in Xcode.</p>
  
  <pre><code>import GoogleAPIClientForREST
  import GTMOAuth2
  import UIKit
  
  class ViewController: UIViewController {
  
      private let kKeychainItemName = "Google Sheets API"
      private let kClientID = "&lt;my key&gt;"
  
      // If modifying these scopes, delete your previously saved credentials by
      // resetting the iOS simulator or uninstall the app.
      private let scopes = [kGTLRAuthScopeSheetsSpreadsheetsReadonly]
  
      private let service = GTLRSheetsService()
      let output = UITextView()
  
      // When the view loads, create necessary subviews
      // and initialize the Google Sheets API service
      override func viewDidLoad() {
          super.viewDidLoad()
  
          output.frame = view.bounds
          output.editable = false
          output.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 20, right: 0)
          output.autoresizingMask = [.FlexibleHeight, .FlexibleWidth]
  
          view.addSubview(output);
  
          if let auth = GTMOAuth2ViewControllerTouch.authForGoogleFromKeychainForName(
              kKeychainItemName,
              clientID: kClientID,
              clientSecret: nil) {
              service.authorizer = auth
          }
  
      }
  
      // When the view appears, ensure that the Google Sheets API service is authorized
      // and perform API calls
      override func viewDidAppear(animated: Bool) {
          if let authorizer = service.authorizer,
              canAuth = authorizer.canAuthorize where canAuth {
              listMajors()
          } else {
              presentViewController(
                  createAuthController(),
                  animated: true,
                  completion: nil
              )
          }
      }
  
      // Display (in the UITextView) the names and majors of students in a sample
      // spreadsheet:
      // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
      func listMajors() {
          output.text = "Getting sheet data..."
          let spreadsheetId = "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
          let range = "Class Data!A2:E"
          let query = GTLRSheetsQuery_SpreadsheetsValuesGet
              .queryWithSpreadsheetId(spreadsheetId, range:range)
          service.executeQuery(query,
                               delegate: self,
                               didFinishSelector: "displayResultWithTicket:finishedWithObject:error:"
          )
      }
  
      // Process the response and display output
      func displayResultWithTicket(ticket: GTLRServiceTicket,
                                   finishedWithObject result : GTLRSheets_ValueRange,
                                   error : NSError?) {
  
          if let error = error {
              showAlert("Error", message: error.localizedDescription)
              return
          }
  
          var majorsString = ""
          let rows = result.values!
  
          if rows.isEmpty {
              output.text = "No data found."
              return
          }
  
          majorsString += "Name, Major:\n"
          for row in rows {
              let name = row[0]
              let major = row[4]
  
              majorsString += "\(name), \(major)\n"
          }
  
          output.text = majorsString
      }
  
  
  
      // Creates the auth controller for authorizing access to Google Sheets API
      private func createAuthController() -&gt; GTMOAuth2ViewControllerTouch {
          let scopeString = scopes.joinWithSeparator(" ")
          return GTMOAuth2ViewControllerTouch(
              scope: scopeString,
              clientID: kClientID,
              clientSecret: nil,
              keychainItemName: kKeychainItemName,
              delegate: self,
              finishedSelector: "viewController:finishedWithAuth:error:"
          )
      }
  
      // Handle completion of the authorization process, and update the Google Sheets API
      // with the new credentials.
      func viewController(vc : UIViewController,
                          finishedWithAuth authResult : GTMOAuth2Authentication, error : NSError?) {
  
          if let error = error {
              service.authorizer = nil
              showAlert("Authentication Error", message: error.localizedDescription)
              return
          }
  
          service.authorizer = authResult
          dismissViewControllerAnimated(true, completion: nil)
      }
  
      // Helper for showing an alert
      func showAlert(title : String, message: String) {
          let alert = UIAlertController(
              title: title,
              message: message,
              preferredStyle: UIAlertControllerStyle.Alert
          )
          let ok = UIAlertAction(
              title: "OK",
              style: UIAlertActionStyle.Default,
              handler: nil
          )
          alert.addAction(ok)
          presentViewController(alert, animated: true, completion: nil)
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  }
  </code></pre>
  
  <p>Am I missing a library or something here? </p>