ModelManager
class ModelManager : NSObject
Manages models that are used by MLKit features.
-
Returns the
ModelManager
instance for the default Firebase app. The default Firebase app instance must be configured before calling this method; otherwise, raisesFIRAppNotConfigured
exception.Declaration
Swift
class func modelManager() -> Self
Return Value
The
ModelManager
instance for the default Firebase app. -
Returns the
ModelManager
instance for the given custom Firebase app. The custom Firebase app instance must be configured before calling this method; otherwise, raisesFIRAppNotConfigured
exception.Declaration
Swift
class func modelManager(app: FIRApp) -> Self
Parameters
app
The custom Firebase app instance.
Return Value
The
ModelManager
instance for the given custom Firebase app. -
Unavailable. Use the
modelManager()
ormodelManager(app:)
class methods. -
Checks whether the given model has been downloaded.
Declaration
Swift
func isModelDownloaded(_ remoteModel: FIRRemoteModel) -> Bool
Parameters
remoteModel
The model to check the download status for.
Return Value
Whether the given model has been downloaded.
-
Downloads the given model from the server to a local directory on the device. Use
isModelDownloaded(_:)
to check the download status for the model. If this method is invoked and the model has already been downloaded, a request is made to check if a newer version of the model is available for download. If available, the new version of the model is downloaded.To be notified when a model download request completes, observe the
.firebaseMLModelDownloadDidSucceed
and.firebaseMLModelDownloadDidFail
notifications defined inFIRModelDownloadNotifications.h
.Declaration
Swift
func download(_ remoteModel: FIRRemoteModel, conditions: FIRModelDownloadConditions) -> Progress
Parameters
remoteModel
The model to download.
conditions
The conditions for downloading the model.
Return Value
Progress for downloading the model.
-
Deletes the downloaded model from the device.
Declaration
Swift
func deleteDownloadedModel(_ remoteModel: FIRRemoteModel, completion: @escaping (Error?) -> Void)
Parameters
remoteModel
The downloaded model to delete.
completion
Handler to call back on the main queue when the model deletion completed successfully or failed with the given
error
.