SwiftAnalytics 0.2.1

SwiftAnalytics 0.2.1

Victor C Tavernari 维护。



  • Tavernari

SwiftAnalytics

CI Status Version License Platform

示例

要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install 命令。

要注册代理

SwiftAnalytics.registerBroker(name: "AnalyticsService") { event in
    //Call your service here like Firebase, GameAnalytics, etc...
}

要调用分析事件

SwiftAnalytics.dispatch(event: AnalyticsEvent(name: eventName1))

要调用屏幕事件

SwiftAnalytics.dispatch(event: ScreenEvent(name: eventName1))

要创建您自己的事件

public class CustonEvent: 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]
    }
}

要移除代理

SwiftAnalytics.unregisterBroker(name: "YOUR_BROKER_NAME")

安装

SwiftAnalytics 可通过 CocoaPods 获取。安装它的简单方法是将以下行添加到您的 Podfile 中

pod 'SwiftAnalytics'

作者

Tavernari, [email protected]

许可证

SwiftAnalytics 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。