Required Associated Typeswift-service-discovery 1.4.0ServiceDiscovery
Instance
Service instance type
associatedtype Instance : Hashable, Sendable
Service instance type
associatedtype Instance : Hashable, Sendable
import ServiceDiscovery
A Service Discovery API for Swift.
@preconcurrency protocol ServiceDiscovery : AnyObject, Sendable
Provides service instances lookup.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
associatedtype Service : Hashable, Sendable
Service identity type
var defaultLookupTimeout: DispatchTimeInterval { get }
Default timeout for lookup.
@preconcurrency func lookup(_ service: Service, deadline: DispatchTime?, callback: @escaping (Result<[Instance], Error>) -> Void)
Performs a lookup for the given service’s instances. The result will be sent to callback
.
@preconcurrency func subscribe(to service: Service, onNext nextResultHandler: @escaping (Result<[Instance], Error>) -> Void, onComplete completionHandler: @escaping (CompletionReason) -> Void) -> CancellationToken
Subscribes to receive a service’s instances whenever they change.