Ir al contenido

onRecommendation(for:onError:_:)

Esta página aún no está disponible en tu idioma.

MethodTryYourSize (Swift)

Calls handler now (once known) and on every change: signing in, a new body, a simulation finishing. Keep the subscription; cancel() it when done.

@discardableResult
public func onRecommendation(for product: String, onError: ((TryYourSizeError) -> Void)? = nil,
_ handler: @escaping (Recommendation) -> Void) -> TYSSubscription
forStringObligatorio

Your product ID or SKU.

onError((TryYourSizeError) -> Void)?Opcional= nil

Called when our window cannot be reached or the app is not registered.

handler@escaping (Recommendation) -> VoidObligatorio

Called now (once known) and on every change.

A subscription: keep it, and cancel() it when you are done.

let sub = tys.onRecommendation(for: "SKU-123") { rec in
if rec.status == .ready, !touched { selectedSize = rec.size }
}
// keep `sub`; sub.cancel() when the screen goes away

¿Te ha resultado útil esta página?