-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAdjustServiceAdapter.swift
56 lines (47 loc) · 1.29 KB
/
AdjustServiceAdapter.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import Foundation
/**
Adapter for the Adjust SDK for iOS.
# Useful links:
- https://github.com/adjust/ios_sdk#event-tracking
# Package example:
```
// swift-tools-version: 5.10
import PackageDescription
let package = Package(
name: "Example",
dependencies: [
.package(name: "Tracker", path: "./swift-event-tracker"),
.package(url: "https://github.com/adjust/ios_sdk", from: "5.0.0"),
],
targets: [
.target(name: "Example", dependencies: [.product(name: "AdjustSdk", package: "ios_sdk"), "Tracker"]),
]
)
```
# Integration example:
```
import AdjustSdk
import Tracker
extension Adjust: AdjustServiceAdapter {
public static func trackEvent(_ eventName: String, parameters: [String: String]) {
guard let event = ADJEvent(eventToken: eventName) else {
return
}
event.setValuesForKeys(parameters)
Adjust.trackEvent(event)
}
public static func setEnabled(_ flag: Bool) {
if flag {
Adjust.enable()
} else {
Adjust.disable()
}
}
}
```
*/
// sourcery: AutoMockable
public protocol AdjustServiceAdapter {
static func trackEvent(_ eventName: String, parameters: [String: String])
static func setEnabled(_ flag: Bool)
}