Skip to content

Instantly share code, notes, and snippets.

@bryanrmq
Created March 6, 2020 09:25
Show Gist options
  • Save bryanrmq/5fc4cc20cdcef8740c180601cc797641 to your computer and use it in GitHub Desktop.
Save bryanrmq/5fc4cc20cdcef8740c180601cc797641 to your computer and use it in GitHub Desktop.
SpectatorProvider
import Foundation
import UIKit
import Spectator
import FirebaseCore
import FirebaseAnalytics
class FirebaseProvider: SpectatorProvider {
public var providerType: SpectatorProviderType = .firebase
public func initialize(application: UIApplication, launchOptions: [UIApplication.LaunchOptionsKey : Any]?) {
guard FirebaseApp.app() != nil else { fatalError("You must do FirebaseApp.configure() before this call.") }
}
public func fire(_ event: SpectatorEventType, withParameters parameters: [String: String]?) {
Analytics.logEvent(event.name, parameters: parameters)
}
}
import Foundation
import UIKit
public protocol SpectatorProvider {
var providerType: SpectatorProviderType { get }
func initialize(application: UIApplication, launchOptions: [UIApplication.LaunchOptionsKey: Any]?)
func fire(_ event: SpectatorEventType, withParameters parameters: [String: String]?)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment