Skip to main content

device_facing_url

Function device_facing_url 

Source
pub fn device_facing_url(target: DevTarget, url: &Url) -> Result<Url>
Expand description

The URL the target should open, rewritten when the target cannot reach this machine’s loopback.

WATERUI_DEV_URL travels in the launch environment on every target — devicectl device process launch -e carries it to a physical iOS device exactly as SIMCTL_CHILD_* carries it to a simulator.

On a physical iOS device localhost is the phone itself, so the URL’s loopback host is replaced with the Mac’s LAN address — the address the device can actually route to. The dev server must be bound to a non-loopback interface for this to work; WebDevServer::spawn does that when its target is a physical device.

§Errors

Fails for DevTarget::IosDevice when no LAN-facing IPv4 address can be determined — passing the phone a localhost URL would fail silently, so this errors instead.