AppEventTracker
AppEventTracker is an iOS library to automatically track various events by injecting code to different functions, like for example viewDidLoad, didReceiveMemoryWarning or sendAction.
The initial reason behind this library is to track the last 10, for example, events before a crash so that the user can get a better understanding of the user flow before the crash.
Example
To run the example project, clone the repo, and run pod install from the Example directory first.
Requirements
- iOS 9.3+
- Xcode 10.1+
- Swift 4.2+
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsAppEventTracker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'AppEventTracker'Then, run the following command:
$ pod installUsage
// Import the library
import AppEventTracker// Declare the number of the events to keep.
AppEventTracker.configure(size: 10)
// Activate the events related with the viewDidLoad
AppEventTracker.enableViewDidLoad()
// Activate the events related with the UIButton's sendAction
AppEventTracker.enableUIButtonSendAction()
// Activate the events related with the UIViewController's didReceiveMemoryWarning
AppEventTracker.enableDidReceiveMemoryWarning()// Get the events
print(AppEventTracker.events)Can be used to send description to Hockeyapp
func applicationLog(for crashManager: BITCrashManager!) -> String! {
// prints "UIViewController1 > UIViewController2 > UIViewController3"
return AppEventTracker.events.map{ $0.name }.joined(separator: " > ")
}Author
Ioannis Diamantidis, [email protected]
License
AppEventTracker is available under the MIT license. See the LICENSE file for more info.