Post

Replies

Boosts

Views

Activity

Detecting tap on tvOS with SwiftUI
For SwiftUI, I found the .focusable() modifier very useful in making views focusable. However, once focused, I found *no* way of detecting a press on that view. I can find if the play/pause button was selected. I can find if the menu button was selected, but found no method to detect taps and long presses. Why are these not available on tvOS? Is there another way?
3
0
3.2k
Jul ’20
NWConnectionGroup no way to send/receive on QUIC stream with identifier `0`
Hello! I'm playing around with QUIC and Swift and using the Network framework. So far, the process has been really straightforward, but I noticed that I can't seem to get a handle on the stream with identifier 0. If I use NWConnection directly, I only have access to the first stream, which has the stream ID 0. This not what I want since I wanna use multiple streams. Following the documentation, I started using NWMultiplexGroup and starting a NWConnectionGroup with it. Everything works fine and I can get all streams that my backend service opens using NWMultiplexGroup's newConnectionHandler property. However, whenever backend sends a message on stream_id 0, none of my connections receive it. Looking around with connection.metadata(definition: NWProtocolQUIC.definition) as? NWProtocolQUIC.Metadata for each connection, I see that all streams are accounted for except stream 0. Then, using the NWConnectionGroup variant of the above connectionGroup.metadata(definition: NWProtocolQUIC.definition) as? NWProtocolQUIC.Metadata I see that the connection group itself has Stream ID 0. However, calling setReceiveHandler does nothing (it's never called, even when backend is sending messages) and when I attempt to send a message using NWConnectionGroup's -send method, a new stream is opened (instead of it being sent on stream ID 0). How can one get a handle on NWConnection for stream ID 0?
1
0
689
Apr ’24