# Firebase

The Firebase dispatcher automatically dispatches events to the [Firebase SDK](https://firebase.google.com/docs/ios/setup), including UTM tags when they are available.

{% tabs %}
{% tab title="SPM" %}

```
https://github.com/BatchLabs/Batch-iOS-firebase-dispatcher.git
```

{% endtab %}

{% tab title="CocoaPods" %}
{% code title="Podfile" %}

```
pod 'BatchFirebaseDispatcher'
```

{% endcode %}
{% endtab %}

{% tab title="Carthage" %}
{% code title="" %}

```
github "BatchLabs/Batch-iOS-firebase-dispatcher"
```

{% endcode %}
{% endtab %}
{% endtabs %}

Don't forget to register the dispatcher:

{% tabs %}
{% tab title="Swift" %}

```swift
@import BatchFirebaseDispatcher

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        BatchEventDispatcher.add(BatchFirebaseDispatcher.instance())
        
        [...]

        BatchSDK.start(withAPIKey: "YOUR_API_KEY")
        return true
    }
}

```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec

// MYAppDelegate.h

@interface MYAppDelegate : UIResponder <UIApplicationDelegate>

[...]

@end

// MYAppDelegate.m

@import BatchFirebaseDispatcher;

@implementation MYAppDelegate

- (BOOL)application:(UIApplication *)application 
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [BatchEventDispatcher addDispatcher:[BatchFirebaseDispatcher instance]];

    [...]

    [BatchSDK startWithAPIKey:@"MY_API_KEY"];
    return YES;
}

@end
```

{% endtab %}
{% endtabs %}
