---
title: hasBetterPath
framework: networkextension
role: symbol
role_heading: Instance Property
path: networkextension/nwudpsession/hasbetterpath
---

# hasBetterPath

If a session has a better path, new session would use a different interface.

## Declaration

```swift
var hasBetterPath: Bool { get }
```

## Discussion

Discussion Evaluates to true if a new session to the remote endpoint would use a different and preferred path. If the current session is not viable, this can be used as a hint to try again. If the current session is still viable, this can indicate that the system or user has a preference for the newly available network path. For example, if the session is established over a cellular data network and Wi-Fi is now available, then the session has a better path available and this property is set to true. Use the initWithUpgradeForSession: initializer to create a new session with the same parameters as the current session. Use Key-Value Observing to watch this property.

## See Also

### Related Documentation

- [isViable](networkextension/nwudpsession/isviable.md)

### Responding to network changes

- [init(upgradeFor:)](networkextension/nwudpsession/init(upgradefor:).md)
