title: Implement Google Analytics in ios swift
body: <p>I am following the Analytics for iOS (developers.google.com/analytics/devguides/collection/ios/v3/?ver=swift) guide and I've got errors in my Swift code Project that I can't fix.
  I am working with XCode 6.4, Swift and the iOS Deployment Target 8.1.</p>
  
  <p><strong>Step 1</strong></p>
  
  <p>First I installed a Google SDK using CocoaPods.
  This is the console result after running <code>pod install</code> command:</p>
  
  <pre><code>Updating local specs repositories
  
  CocoaPods 1.0.0.beta.2 is available.
  To update use: `gem install cocoapods --pre`
  [!] This is a test version we'd love you to try.
  
  For more information see http://blog.cocoapods.org
  and the CHANGELOG for this version http://git.io/BaH8pQ.
  
  Analyzing dependencies
  Downloading dependencies
  Using Google (1.0.7)
  Using GoogleAnalytics (3.14.0)
  Using GoogleNetworkingUtilities (1.0.0)
  Using GoogleSymbolUtilities (1.0.3)
  Using GoogleUtilities (1.1.0)
  Generating Pods project
  Integrating client project
  Sending stats
  Pod installation complete! There is 1 dependency from the
  Podfile and 5 total pods installed.
  </code></pre>
  
  <p><strong>Step 2</strong></p>
  
  <p>Then opened, as said in the guide, my app's Project .xcworkspace file.</p>
  
  <p>My Podfile looks like this:</p>
  
  <pre><code># Uncomment this line to define a global platform for your project
  # platform :ios, '8.0'
  # Uncomment this line if you're using Swift
  # use_frameworks!
  
  target 'XXXXXX' do
  
  source 'https://github.com/CocoaPods/Specs.git'
  platform :ios, '8.1'
  pod 'Google/Analytics', '~&gt; 1.0.0'
  
  end
  
  target 'XXXXXXTests' do
  
  pod 'Google/Analytics', '~&gt; 1.0.0'
  
  end
  </code></pre>
  
  <p>Where XXXXXX is my Project's name.</p>
  
  <p><strong>Step 3</strong></p>
  
  <p>I got the configuration file <code>GoogleService-Info.plist</code> and included in my Project adding all the targets (2 targets in my project).</p>
  
  <p><strong>Step 4</strong></p>
  
  <p>I created a <code>BridgingHeader</code> by by choosing File > New > File > iOS > Source > Header File. 
  I named it <code>BridgingHeader.h</code> and is in the root of my Project.
  The content is:</p>
  
  <pre><code>#ifndef XXXXX_BridgingHeader_h
  #define XXXXX_BridgingHeader_h
  
  #import "Google/Analytics.h"
  #import &lt;Google/Analytics.h&gt;
  #include "GAI.h"
  
  #import &lt;CoreData/CoreData.h&gt;
  #import &lt;SystemConfiguration/SystemConfiguration.h&gt;
  
  #import "Libraries/GoogleAnalytics/GAI.h"
  #import "Libraries/GoogleAnalytics/GAIFields.h"
  #import "Libraries/GoogleAnalytics/GAILogger.h"
  #import "Libraries/GoogleAnalytics/GAITracker.h"
  #import "Libraries/GoogleAnalytics/GAIDictionaryBuilder.h"
  
  #endif
  </code></pre>
  
  <p>Where "XXXXX" is my Project's name.</p>
  
  <p><strong>Step 5</strong></p>
  
  <p>Now the problems: 
  I tried to include/import the Google Analytics into my AppDelegate.swift but I can't. This is the error:</p>
  
  <p><a href="http://i.stack.imgur.com/NZwzQ.png" rel="noreferrer">AppDelegate.swift import Google Analytics</a></p>
  
  <p>I also tried <code>import "Google/Analytics.h"</code> but another error appears: <code>Expected identifier in import declaration</code>.</p>
  
  <ul>
  <li><strong>How can I fix this so XCode doesn't give me errors?</strong></li>
  <li><strong>Is the BridgingHeader wrong? Do I have to point at this somehow to recognize its inner headers?</strong></li>
  <li><strong>Do I have to configure something else for the Google Analytics that I am missing right now?</strong></li>
  </ul>
  
  <p>Thank you very much.</p>