Collar is a library which simplifies analytics debugging by showing events, screen views and user properties of your app as they happen.
- Swift 5.1
- Xcode 14.0
- iOS 15.0
Collar is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Collar'If you are using the SwiftPM as your dependencies manager, add this to the dependencies in your Package.swift file:
dependencies: [
.package(url: "https://github.com/infinum/ios-collar.git")
]import Collar
// Events
AnalyticsCollectionManager.shared.log(event: "some_event", parameters: [
"param1": "value1",
"param2": "value2"
])
// User properties
AnalyticsCollectionManager.shared.setUserProperty("some_value", forName: "user_property_key")
// Screen views
AnalyticsCollectionManager.shared.track(screenName: "Home", screenClass: "HomeViewController")IMPORTANT: Collar does NOT send out analytics data to remote services. This is left for the developer to solve in their own codebase, with Collar being simply a reflection of the current state of analytics data.
/// UIKit
AnalyticsCollectionManager.shared.showLogs(from: viewController)
/// SwiftUI
Button(action: { isPresented = true }) { ... }
.collarLogSheet(isPresented: $isPresented)Please make sure that AnalyticsCollectionManager is not used in production builds. Best option would be not to include Collar in you production targets/configurations at all, for example:
pod 'Collar', :configurations => ['Development-release', 'Development-debug']To run the example project, clone the repo, and run pod install from the Example directory first.
Filip Gulan, filip.gulan@infinum.com
Maintained and sponsored by Infinum.
Collar is available under the MIT license. See the LICENSE file for more info.

