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

# hasBetterPath

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

## Declaration

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

## Discussion

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

## See Also

### Related Documentation

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

### Responding to network changes

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