Search documentation of mob

# Mob.Device.IOS (mob v0.6.18)

Copy Markdown View Source

iOS-specific device events. Subscribers receive events that either have no Android counterpart (e.g. `:protected_data_did_become_available`) or carry extra iOS fidelity beyond what `Mob.Device` exposes cross-platform.

Messages are tagged `:mob_device_ios`:

    {:mob_device_ios, event}
    {:mob_device_ios, event, payload}

## Subscribe

    Mob.Device.IOS.subscribe()

## Events

All cross-platform `Mob.Device` events are also re-emitted here under the same atom (so users targeting iOS only can subscribe just to this module and get the full event set). Plus iOS-only:

- `:protected_data_will_become_unavailable` — device about to lock; data protection class A files become unreadable shortly after.
- `:protected_data_did_become_available` — device unlocked.
- `:audio_route_changed` — output route changed (headphones plugged in, Bluetooth connected, etc.).

## Raw queries

When `Mob.Device` normalizes values (e.g. thermal `:nominal/:fair/...`), this module exposes the raw native values for diagnostics.

    Mob.Device.IOS.raw_thermal_state()  # 0..3 (NSProcessInfoThermalState)

## Summary

### Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

raw_thermal_state()

Raw `NSProcessInfoThermalState` value (0=nominal, 1=fair, 2=serious, 3=critical).

start_link(opts \\ [])
subscribe()

Subscribe the calling process to iOS-specific device events.

unsubscribe()

Unsubscribe the calling process.

## Functions

# child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# raw_thermal_state()

    @spec raw_thermal_state() :: 0 | 1 | 2 | 3

Raw `NSProcessInfoThermalState` value (0=nominal, 1=fair, 2=serious, 3=critical).

Provided for diagnostics. Most code should use `Mob.Device.thermal_state/0` which returns a normalized atom shared with Android.

# start_link(opts \\ [])

    @spec start_link(keyword()) :: GenServer.on_start()

# subscribe()

    @spec subscribe() :: :ok

Subscribe the calling process to iOS-specific device events.

# unsubscribe()

    @spec unsubscribe() :: :ok

Unsubscribe the calling process.