AnalyticsManager
public protocol AnalyticsManager : AnyObject
This represents a class that manages analytics logs.
Objects conforming this protocol must call observeAnalyticsLogs
.
By default, the observeAnalyticsLogs
sets up the conforming object to observe notifications with names of Notification.Name.logEvent
and Notification.Name.logScreen
.
The selector for the Notification.Name.logEvent
notification is the logEvent(from:)
method, while the selector for the Notification.Name.logScreen
is logScreen(from:)
method.
This protocol is best to be conformed by the AppDelegate
of an app.
And then implementing the logEvent(from:)
and logScreen(from:)
methods with calls to the designated analytics service.
-
The log event observer object.
Declaration
Swift
var logEventObserver: NSObjectProtocol? { get set }
-
The log screen observer object.
Declaration
Swift
var logScreenObserver: NSObjectProtocol? { get set }
-
observeAnalyticsLogs()
Default implementationObserves for analytics logs.
By default, this observes for notifications sent with the notification name of
Notification.Name.logEvent
andNotification.Name.logScreen
. The selector for theNotification.Name.logEvent
notification is thelogEvent(from:)
method, while the selector for theNotification.Name.logScreen
islogScreen(from:)
method.Default Implementation
Declaration
Swift
func observeAnalyticsLogs()
-
removeAnalyticsLogsObservers()
Default implementationRemoves the analytics logs observers from the notification center.
By default, this removes the log event and log screen observers from the notification center.
Default Implementation
Declaration
Swift
func removeAnalyticsLogsObservers()
-
Logs the event from the specified notification.
Declaration
Swift
func logEvent(from notification: Notification)
-
Logs the screen from the specified notification.
Declaration
Swift
func logScreen(from notification: Notification)