Protocol
Loader
public protocol Loader: ObservableObject, ThrowsErrors
A type that can load data from a source and throw errors.
Relationships
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
Name | Type | Description |
---|---|---|
key | Key |
The key identifying the object to load. |
createPublisher(key:)
func createPublisher(key: Key) -> AnyPublisher<Object, Error>?
Creates a publisher that loads the object.
Parameters
Name | Type | Description |
---|---|---|
key | Key |
The key identifying the object to load. |
loadData(key:)
func loadData(key: Key)
Starts loading the object's data.
Parameters
Name | Type | Description |
---|---|---|
key | Key |
The key identifying the object to load. |
loadCompleted(key:object:)
func loadCompleted(key: Key, object: Object)
Called when the object has been loaded successfully.
Parameters
Name | Type | Description |
---|---|---|
key | Key |
The key identifying the object that was loaded. |
object | Object |
The loaded object. |
cancel()
func cancel()