ModelManager

class ModelManager : NSObject

A Firebase model manager for both local and cloud models.

  • Gets the model manager for the default Firebase app. The default Firebase app instance must be configured before calling this method; otherwise raises AppNotConfigured exception. The returned model manager is thread safe. Models hosted in non-default Firebase apps are currently not supported.

    Declaration

    Swift

    class func modelManager() -> Self

    Return Value

    A model manager for the default Firebase app.

  • Unavailable. Use the modelManager class method.

  • Registers a cloud model. The model name is unique to each cloud model and can only be registered once with a given instance of the ModelManager. The model name should be the same name used when uploading the model to the Firebase Console. It’s OK to separately register a cloud model and a local model with the same name for a given instance of the ModelManager.

    Declaration

    Swift

    func register(_ cloudModelSource: CloudModelSource) -> Bool

    Parameters

    cloudModelSource

    The cloud model source to register.

    Return Value

    Whether the registration was successful. Returns NO if the given cloudModelSource is invalid or has already been registered.

  • Registers a local model. The model name is unique to each local model and can only be registered once with a given instance of the ModelManager. It’s OK to separately register a cloud model and a local model with the same name for a given instance of the ModelManager.

    Declaration

    Swift

    func register(_ localModelSource: LocalModelSource) -> Bool

    Parameters

    localModelSource

    The local model source to register.

    Return Value

    Whether the registration was successful. Returns NO if the given localModelSource is invalid or has already been registered.

  • Gets the registered cloud model with the given name. Returns nil if the model was never registered with this model manager.

    Declaration

    Swift

    func cloudModelSource(forModelName name: String) -> CloudModelSource?

    Parameters

    name

    Name of the cloud model.

    Return Value

    The cloud model that was registered with the given name. Returns nil if the model was never registered with this model manager.

  • Gets the registered local model with the given name. Returns nil if the model was never registered with this model manager.

    Declaration

    Swift

    func localModelSource(forModelName name: String) -> LocalModelSource?

    Parameters

    name

    Name of the local model.

    Return Value

    The local model that was registered with the given name. Returns nil if the model was never registered with this model manager.