ResourceEvent

public enum ResourceEvent

The possible causes of a call to ResourceObserver.resourceChanged(_:event:).

See also

Resource.load()
  • Immediately sent to a new observer when it first starts observing a resource. This event allows you to gather all of your “update UI from resource state” code in one place, and have that code be called both when the UI first appears and when the resource state changes.

    Note that this is sent only to the newly attached observer, not all observers.

    Declaration

    Swift

    case observerAdded
  • A load request for this resource started. Resource.isLoading is now true.

    Declaration

    Swift

    case requested
  • The request in progress was cancelled before it finished.

    Declaration

    Swift

    case requestCancelled
  • The resource’s latestData property has been updated.

    Declaration

    Swift

    case newData(ResourceEvent.NewDataSource)
  • The request in progress succeeded, but did not result in a change to the resource’s latestData (except the timestamp). Note that you may still need to update the UI, because if latestError was present before, it is now nil.

    Declaration

    Swift

    case notModified
  • The request in progress failed. Details are in the resource’s latestError property.

    Declaration

    Swift

    case error
  • Possible sources of ResourceEvent.newData.

    See more

    Declaration

    Swift

    public enum NewDataSource : String, CustomStringConvertible