To run the example project, clone the repo, and run pod install
from the Example directory first.
To register a broker
SwiftAnalytics.registerBroker(name: "AnalyticsService") { event in
//Call your service here like Firebase, GameAnalytics, etc...
}
To call an analytic event
SwiftAnalytics.dispatch(event: AnalyticsEvent(name: eventName1))
To call an screen event
SwiftAnalytics.dispatch(event: ScreenEvent(name: eventName1))
To creat your own event
public class CustomEvent: Event {
public let name: String
public let kind: Kind = .custom("MY OWN EVENT KIND")
public var params: [String: Any]?
public init(name: String, customParam:Int) {
self.name = name
self.params = ["custom": customParam]
}
}
To remove a broker
SwiftAnalytics.unregisterBroker(name: "YOUR_BROKER_NAME")
SwiftAnalytics is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SwiftAnalytics'
Tavernari, victortavernari@gmail.com
SwiftAnalytics is available under the MIT license. See the LICENSE file for more info.