We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a8dd5ff commit 2930115Copy full SHA for 2930115
Sources/Mixpanel.swift
@@ -231,6 +231,17 @@ open class Mixpanel {
231
}
232
233
234
+ /// Returns the main Mixpanel instance if it has been initialized.
235
+ /// - Returns: An optional MixpanelInstance, or nil if not yet initialized.
236
+ public class func safeMainInstance() -> MixpanelInstance? {
237
+ if let instance = MixpanelManager.sharedInstance.getMainInstance() {
238
+ return instance
239
+ } else {
240
+ MixpanelLogger.warn(message: "WARNING: Mixpanel main instance is NOT initialized. Call Mixpanel.initialize(...) first.")
241
+ return nil
242
+ }
243
244
+
245
/**
246
Sets the main instance based on the instance name
247
0 commit comments