insidegui / insidegui/MultipeerKit

additional, custom, local info in Peer

Aperta
#23 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Swift
Stelle
1.1k
Fork
79
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi,

although I try to minimize states, in an upcoming project I could use additional, local state information inside a `Peer`, e.g.

- last "heartbeat" timestamp
- a "busy" state
- additional ready/in-sync state on top of `isConnected`

Normally I would subclass `Peer` but MultiPeerKit would not use it obviously. In rare cases I would use objc dynamic runtime and add an "object association" but `Peer` is a struct.

Currently, a "wrapper" would be needed to map an additional local struct to a peer. This creates update problems, keeping the local struct and the peer list in sync - an ugly and weak approach.

I thought about the common `userInfo` dict approach each `Peer` could offer for custom key-values. Sadly this is not very Swift-friendly although a local extension with computed properties could hide the dict.

This `userInfo` dict is probably the least invasive approach for the current code, or do you have another idea in mind that is better suited?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by reviewing the Peer struct and how the peer list is kept in sync. The issue discusses custom local state such as heartbeat, busy, and readiness information, with a userInfo dictionary or wrapper as possible approaches; done requires a settled API design and an agreed way to associate that state with each Peer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
swift
Ambito
networking
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.