userId
A property on Superwall.shared that returns the current user's ID.
The anonymous user ID is automatically generated and persisted to disk, so it remains consistent across app launches until the user is identified.
Purpose
Returns the current user's unique identifier, either from a previous call to identify()
or an anonymous ID if not identified.
Signature
Parameters
This is a read-only computed property on the Superwall.shared
instance with no parameters.
Returns / State
Returns a String
representing the user's ID. If identify()
has been called, returns that user ID. Otherwise, returns an automatically generated anonymous user ID that is cached to disk.
Usage
Get the current user ID:
Check if user is identified:
Example usage in analytics:
Example usage in custom logging:
How is this guide?