MMMLoadableState

Objective-C

enum MMMLoadableState : NSInteger {}

Swift

@frozen enum MMMLoadableState : Int, @unchecked Sendable

Main states a loadable object can be in. I was using ‘loading’/‘loaded successfully’/‘failed to load’ before, but this is less natural when we are uploading/saving something, so went with ‘syncing’.

  • Nothing is happening with the object now. It’s been never synced or the result of the last sync is not known or important. (Promises — ‘not ready’.)

    Declaration

    Objective-C

    MMMLoadableStateIdle

    Swift

    case idle = 0
  • The object is being synced now (e.g. the contents is being downloaded or saved somewhere). (Promises — ‘in-progress’.)

    Declaration

    Objective-C

    MMMLoadableStateSyncing

    Swift

    case syncing = 1
  • The object has been successfully synced and its contents (promises — value) is available now. (Promises — ‘resolved’.) (A name is a bit longer than just ‘synced’ here so it’s easier to differentiate from ‘syncing’.)

    Declaration

    Objective-C

    MMMLoadableStateDidSyncSuccessfully

    Swift

    case didSyncSuccessfully = 2
  • The object has not been able to sync for some reason. (Promises — ‘rejected’.)

    Declaration

    Objective-C

    MMMLoadableStateDidFailToSync

    Swift

    case didFailToSync = 3