Post

Replies

Boosts

Views

Activity

Reply to NWConnection cancel
as an addition to @jakajancar's answer let me introduce an example code ; Send a message to the connection you want to cancel; set contentContext: parameter to NWConnection.ContentContext.finalMessage, then cancel the connection: connectionYouWantToCancel.send(content: nil, contentContext: .finalMessage, isComplete: true, completion: .idempotent) connectionYouWantToCancel.cancel() And read the message on the other device; check if the context is final connectionOnTheOtherDevice.receiveMessage { (content, context, isComplete, error) in if let context = context, context.isFinal { connectionOnTheOtherDevice.cancel() // any other logic if needed. return } // other logic } At least I'm handling the problem this way without any delay or any unexpected behaviour.
Jan ’24
Reply to NWConnection cancel
as an addition to @jakajancar's answer let me introduce an example code ; Send a message to the connection you want to cancel; set contentContext: parameter to NWConnection.ContentContext.finalMessage, then cancel the connection: connectionYouWantToCancel.send(content: nil, contentContext: .finalMessage, isComplete: true, completion: .idempotent) connectionYouWantToCancel.cancel() And read the message on the other device; check if the context is final connectionOnTheOtherDevice.receiveMessage { (content, context, isComplete, error) in if let context = context, context.isFinal { connectionOnTheOtherDevice.cancel() // any other logic if needed. return } // other logic } At least I'm handling the problem this way without any delay or any unexpected behaviour.
Replies
Boosts
Views
Activity
Jan ’24
Reply to NavigationView jumps when transitioning from displayMode large to inline
Still have the same issue
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’23