This convenience initializer can be used to create a new session based on the original session’s endpoint and parameters.


init(upgradeFor session: NWUDPSession)


The caller should watch the hasBetterPath property on an existing NWUDPSession object. When hasBetterPath is true, the caller should call initWithUpgradeForSession: to create a new session, then start transferring data on the new session as soon as possible to reduce power and and avoid expensive networks. When the new session is ready, the application can start using the new session and tear down the original one.

See Also

Responding to Network Changes

var hasBetterPath: Bool

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