-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathContents.swift
48 lines (41 loc) · 1.38 KB
/
Contents.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
//: [Previous](@previous)
//: For this page, make sure your build target is set to ParseSwift (macOS) and targeting
//: `My Mac` or whatever the name of your mac is. Also be sure your `Playground Settings`
//: in the `File Inspector` is `Platform = macOS`. This is because
//: Keychain in iOS Playgrounds behaves differently. Every page in Playgrounds should
//: be set to build for `macOS` unless specified.
import PlaygroundSupport
import Foundation
import ParseSwift
PlaygroundPage.current.needsIndefiniteExecution = true
initializeParse()
//: To track when the app has been opened, do the following.
ParseAnalytics.trackAppOpened { result in
switch result {
case .success:
print("Saved analytics for app opened.")
case .failure(let error):
print(error)
}
}
//: To track any event, do the following.
var friendEvent = ParseAnalytics(name: "openedFriendList")
friendEvent.track { result in
switch result {
case .success:
print("Saved analytics for custom event.")
case .failure(let error):
print(error)
}
}
//: You can also add dimensions to your analytics.
friendEvent.track(dimensions: ["more": "info"]) { result in
switch result {
case .success:
print("Saved analytics for custom event with dimensions.")
case .failure(let error):
print(error)
}
}
PlaygroundPage.current.finishExecution()
//: [Next](@next)