Skip to content

Async/Await stream-based API for Multipeer Connectivity

License

Notifications You must be signed in to change notification settings

theolampert/PeerStream

Repository files navigation

PeerStream

A simple wrapper around Multipeer Connectivity using async iterator streams.

let peerStream: PeerStream = PeerStream()
Task {
    for try await message in peerStream {
        switch message {
        case .onStateChange(state: let state, peer: let peer):
            print("STREAM", state == .connected, peer.displayName)
        default:
            break
        }
    }
}

Releases

No releases published

Packages

No packages published

Languages