/PeerStream

Async/Await stream-based API for Multipeer Connectivity

Primary LanguageSwiftMIT LicenseMIT

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
        }
    }
}