The Publisher receives the Subscriber
Publisher.receive(subscriber:)
The Publisher creates the Subscription passing in self
(the Publisher) and the Subscriber
let subscription = Subscription(self, subscriber)
import Combine | |
import Foundation | |
import Network | |
public extension NWConnection { | |
func send(content: Data?) -> some Publisher<Void, Error> { | |
Deferred { | |
Future<Void, Error> { [weak self] promise in | |
guard let self = self else { return } | |
self.send( |
{ | |
"meta": { | |
"theme": "crispy-potato", | |
"palette": { | |
"primary": "grey", | |
"secondary": "blue" | |
} | |
}, | |
"basics": { | |
"name": "Chris D'Annunzio", |