getDeviceAttributes
Gets properties stored about the device that are used in audience filters.
This method returns all device attributes that can be used in audience filters in the Superwall dashboard.
isApplePayAvailable is deprecated starting in 4.11.2 and now always returns true. It will be removed in a future release and should no longer be used in audience filters.
Purpose
Retrieves a dictionary of device properties that are used when evaluating audience filters. This is useful for debugging audience filter behavior or understanding what device attributes are available.
Signature
public func getDeviceAttributes() async -> [String: Any]Parameters
No parameters.
Returns / State
Returns a dictionary mapping attribute names to their values. Common attributes include:
isApplePayAvailable- Deprecated in 4.11.2 and alwaystrue(previously indicated Apple Pay availability)swiftVersion- The Swift version (available in version 4.7.0+)compilerVersion- The compiler version (available in version 4.7.0+)localeIdentifier- The device localeosVersion- The iOS versionmodel- The device model- And many more device-specific attributes
Usage
Get device attributes:
let deviceAttributes = await Superwall.shared.getDeviceAttributes()
// Check specific attributes
// `isApplePayAvailable` is deprecated and always true in 4.11.2+
// Print all attributes for debugging
print("Device attributes: \(deviceAttributes)")Use in audience filter debugging:
Task {
let attributes = await Superwall.shared.getDeviceAttributes()
// Check if user matches an audience filter condition
if let swiftVersion = attributes["swiftVersion"] as? String {
print("Swift version: \(swiftVersion)")
}
}Related
- Device attributes are automatically used in audience filters
isApplePayAvailablewas added in 4.9.0, updated in 4.10.5, and deprecated in 4.11.2 (now alwaystrue)swiftVersionandcompilerVersionwere added in version 4.7.0
How is this guide?
Edit on GitHub