DefaultDeviceCollector

public struct DefaultDeviceCollector

Factory for creating the standard set of device information collectors.

This struct provides a convenient way to obtain the default collection of device collectors that gather comprehensive device profile information including platform, hardware, network, and capability data.

  • Creates and returns the standard set of device collectors.

    This method provides a pre-configured array of collectors that gather essential device information for device profiling and fingerprinting purposes.

    Included Collectors

    • PlatformCollector: OS version, device model, locale, security status
    • HardwareCollector: Memory, CPU, display, and camera specifications
    • BrowserCollector: User agent string from WebKit engine
    • TelephonyCollector: Cellular carrier and network information
    • NetworkCollector: Current network connectivity status
    • BluetoothCollector: Bluetooth Low Energy capability information

    Usage Example

    let collectors = DefaultDeviceCollector.defaultDeviceCollectors()
    let deviceProfile = try await collectors.collect()
    

    Customization

    You can modify the returned array to add, remove, or replace collectors:

    var collectors = DefaultDeviceCollector.defaultDeviceCollectors()
    collectors.append(CustomCollector())
    collectors.removeAll { $0.key == "bluetooth" }
    

    Performance Notes

    • Each collector operates independently and asynchronously
    • Failed collectors don’t prevent others from succeeding
    • Collection order may vary due to async execution
    • Some collectors may require user permissions (location, camera)

    Declaration

    Swift

    public static func defaultDeviceCollectors() -> [any DeviceCollector]

    Return Value

    Array of device collectors for comprehensive data collection

  • Creates and returns the default location collector. This method provides a pre-configured location collector that gathers device location information, subject to user permissions.

    Declaration

    Swift

    public static func defaultLocationCollector() -> LocationCollector