Contents

networkEvents(matching:)

Returns an async sequence of network events, containing current shared networks and future updates.

Declaration

func networkEvents(matching predicate: Predicate<WINetworkSharingProvider.Network>? = nil) -> some Sendable & AsyncSequence<WINetworkSharingProvider.NetworkEvent, any Error>

Parameters

  • predicate:

    An optional predicate for filtering the shared networks list. The default is nil, meaning you receive all networks.

Return Value

An async sequence that delivers WINetworkSharingProvider.NetworkEvent instances whenever your app extension needs to update its network information or present UI.

Discussion

Use this method to monitor changes to the shared networks list and respond to system events, like new network availability or sharing requests from your container app.

See Also

Getting network updates