Skip to content

Commit d46f461

Browse files
initial commit
0 parents  commit d46f461

16 files changed

+1106
-0
lines changed

.gitignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
## User settings
6+
xcuserdata/
7+
8+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
9+
*.xcscmblueprint
10+
*.xccheckout
11+
12+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
13+
build/
14+
DerivedData/
15+
*.moved-aside
16+
*.pbxuser
17+
!default.pbxuser
18+
*.mode1v3
19+
!default.mode1v3
20+
*.mode2v3
21+
!default.mode2v3
22+
*.perspectivev3
23+
!default.perspectivev3
24+
25+
## Obj-C/Swift specific
26+
*.hmap
27+
28+
## App packaging
29+
*.ipa
30+
*.dSYM.zip
31+
*.dSYM
32+
33+
## Playgrounds
34+
timeline.xctimeline
35+
playground.xcworkspace
36+
37+
# Swift Package Manager
38+
#
39+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
40+
# Packages/
41+
# Package.pins
42+
# Package.resolved
43+
# *.xcodeproj
44+
#
45+
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
46+
# hence it is not needed unless you have added a package configuration file to your project
47+
# .swiftpm
48+
49+
.build/
50+
51+
# CocoaPods
52+
#
53+
# We recommend against adding the Pods directory to your .gitignore. However
54+
# you should judge for yourself, the pros and cons are mentioned at:
55+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
56+
#
57+
# Pods/
58+
#
59+
# Add this line if you want to avoid checking in source code from the Xcode workspace
60+
# *.xcworkspace
61+
62+
# Carthage
63+
#
64+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
65+
# Carthage/Checkouts
66+
67+
Carthage/Build/
68+
69+
# Accio dependency management
70+
Dependencies/
71+
.accio/
72+
73+
# fastlane
74+
#
75+
# It is recommended to not store the screenshots in the git repo.
76+
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
77+
# For more information about the recommended setup visit:
78+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
79+
80+
fastlane/report.xml
81+
fastlane/Preview.html
82+
fastlane/screenshots/**/*.png
83+
fastlane/test_output
84+
85+
# Code Injection
86+
#
87+
# After new code Injection tools there's a generated folder /iOSInjectionProject
88+
# https://github.com/johnno1962/injectionforxcode
89+
90+
iOSInjectionProject/
91+
92+
# macOS
93+
.DS_Store
94+
.AppleDouble
95+
.LSOverride
96+
97+
# Icon must end with two \r
98+
Icon
99+
100+
# Thumbnails
101+
._*
102+
103+
# Files that might appear in the root of a volume
104+
.DocumentRevisions-V100
105+
.fseventsd
106+
.Spotlight-V100
107+
.TemporaryItems
108+
.Trashes
109+
.VolumeIcon.icns
110+
.com.apple.timemachine.donotpresent
111+
112+
# Directories potentially created on remote AFP share
113+
.AppleDB
114+
.AppleDesktop
115+
Network Trash Folder
116+
Temporary Items
117+
.apdisk
118+
119+
# IDE
120+
.vscode/
121+
.idea/
122+
123+
# Temporary files
124+
*.tmp
125+
*.temp
126+
*~
127+
128+
# Log files
129+
*.log

Examples/Usage.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import CHAnalytics
2+
3+
func setupAnalytics() {
4+
let analytics = Analytics {
5+
FirebaseAnalyticsEngine()
6+
AmplitudeAnalyticsEngine(apiKey: "your-amplitude-key")
7+
ConsoleAnalyticsEngine()
8+
}
9+
10+
analytics.configure(for: .applicationDidFinishLaunching(isDebug: true))
11+
}
12+
13+
func trackingExamples() {
14+
analytics.track(event: Event.screenView(screen: "HomeScreen"))
15+
16+
analytics.track(event: Event.buttonTap(buttonName: "SignUp", screen: "LoginScreen"))
17+
18+
analytics.track(event: Event.purchase(amount: 9.99, currency: "USD", itemName: "Premium"))
19+
20+
analytics.track(event: Event(name: "custom_event", parameters: [
21+
"category": "engagement",
22+
"value": 42
23+
]))
24+
25+
analytics.track(userProperty: UserProperty(properties: [
26+
"subscription_tier": "premium",
27+
"onboarding_completed": true
28+
]))
29+
30+
analytics.setUser(identifier: "user-123")
31+
32+
analytics.setGlobalProperty(key: "app_version", value: "1.0.0")
33+
}

Package.resolved

Lines changed: 167 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "CHAnalytics",
8+
platforms: [
9+
.iOS(.v13),
10+
.macOS(.v11),
11+
.tvOS(.v13),
12+
.watchOS(.v6)
13+
],
14+
products: [
15+
.library(
16+
name: "CHAnalytics",
17+
targets: ["CHAnalytics"]
18+
),
19+
],
20+
dependencies: [
21+
.package(url: "https://github.com/Chainless-Dev/CHLogger.git", branch: "main"),
22+
.package(url: "https://github.com/firebase/firebase-ios-sdk.git", exact: "11.15.0"),
23+
.package(url: "https://github.com/amplitude/Amplitude-Swift.git", exact: "1.13.9")
24+
],
25+
targets: [
26+
.target(
27+
name: "CHAnalytics",
28+
dependencies: [
29+
.product(name: "CHLogger", package: "CHLogger"),
30+
.product(name: "FirebaseAnalytics", package: "firebase-ios-sdk"),
31+
.product(name: "FirebaseCrashlytics", package: "firebase-ios-sdk"),
32+
.product(name: "AmplitudeSwift", package: "Amplitude-Swift")
33+
]
34+
),
35+
.testTarget(
36+
name: "CHAnalyticsTests",
37+
dependencies: ["CHAnalytics"]
38+
),
39+
]
40+
)

0 commit comments

Comments
 (0)