Ir al contenido

on(_:)

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

MethodTryYourSize (Swift)

Window events: ready, open, close, size, loadError.

@discardableResult
public func on(_ handler: @escaping (Event) -> Void) -> TYSSubscription
handler@escaping (Event) -> VoidObligatorio

Called with each window event.

.ready(product: String)Opcional

The window is shown and connected.

.open(product: String)Opcional
.close(product: String)Opcional
.size(SizeSelection)Opcional

The shopper chose a size: preselect it.

.loadError(TryYourSizeError)Opcional

Our window could not be reached, or this app is not registered for the key.

A subscription; cancel() stops the events.

let sub = tys.on { event in
switch event {
case .size(let selection): selectedSize = selection.size // "Use this size"
case .loadError(let error): print(error.code)
default: break
}
}

¿Te ha resultado útil esta página?