awaitLoaded

suspend fun <T : LoadPhaseProvider> T.awaitLoaded(): T

Suspends until the view has finished loading, then returns it.

Returns (or throws) immediately if loading already finished. Supports cancellation.

An extension rather than an interface member so it can return the concrete receiver type — the Kotlin equivalent of the Self-returning protocol extension on iOS.

Return

this view, fully loaded.

Throws

the loading error if the view failed to load.