Loadability Documentation Beta

Protocol Loader

public protocol Loader: ObservableObject, ThrowsErrors

A type that can load data from a source and throw errors.

%3 Loader Loader ThrowsErrors ThrowsErrors Loader->ThrowsErrors ObservableObject ObservableObject Loader->ObservableObject SimpleNetworkLoader SimpleNetworkLoader SimpleNetworkLoader->Loader CachedLoader CachedLoader CachedLoader->Loader

Conforms To

ThrowsErrors

A type that can throw errors that should be shown to the user.

ObservableObject

Types Conforming to Loader

CachedLoader

A type that can load data from a source with caching.

SimpleNetworkLoader

A type that can load data from over the network and throw errors.

Requirements

object

var object: Object?

A publisher for the object that is loaded.

cancellable

var cancellable: AnyCancellable?

An ongoing request.

load(key:​)

func load(key: Key)

Begins loading the object.

Parameters

key Key

The key identifying the object to load.

create​Publisher(key:​)

func createPublisher(key: Key) -> AnyPublisher<Object, Error>?

Creates a publisher that loads the object.

Parameters

key Key

The key identifying the object to load.

load​Data(key:​)

func loadData(key: Key)

Starts loading the object's data.

Parameters

key Key

The key identifying the object to load.

load​Completed(key:​object:​)

func loadCompleted(key: Key, object: Object)

Called when the object has been loaded successfully.

Parameters

key Key

The key identifying the object that was loaded.

object Object

The loaded object.

cancel()

func cancel()