FritzManagedModel

@available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)
@objcMembers
public class FritzManagedModel : NSObject

Coordinates tasks for interacting with Fritz Models.

  • Currenly active model configuration.

    Note this this is a globally active config for a model. If you have multiple FritzManagedModel instances and a new version is downloaded, all instances will be updated with the latest configuration..

    Declaration

    Swift

    public private(set) var activeModelConfig: FritzModelConfiguration
  • id

    Model Identifier of active model.

    Declaration

    Swift

    public var id: String { get }
  • Model Version number of active model.

    Declaration

    Swift

    public var version: Int { get }
  • If true, the active model config version is downloaded.

    Declaration

    Swift

    public var isVersionDownloaded: Bool { get }
  • If true, there is at least one active model downloaded

    Declaration

    Swift

    public var hasDownloadedModel: Bool { get }
  • The type of the identified model, if initialized from a conformed model. Storing this gives us access to the url of the identified model, so you can call self.loadModel() and load the model included in the package.

    Declaration

    Swift

    public let packagedIdentifiedModelType: BaseIdentifiedModel.Type?
  • Creates FritzManagedModel from model configuration.

    Declaration

    Swift

    @objc(initWithModelConfig:sessionManager:loadActive:packagedModelType:)
    public init(
      modelConfig: FritzModelConfiguration,
      sessionManager: SessionManager? = nil,
      loadActiveFromDisk: Bool = true,
      packagedIdentifiedModelType: BaseIdentifiedModel.Type? = nil
    )

    Parameters

    modelConfig

    Specifies which model class is operating on.

    sessionManager

    Optional SessionManager. If not included uses default globally shared SessionManager.

    loadActiveFromDisk

    If true (default) will load latest model downloaded over the air.

    packagedIdentifiedModelType

    Optional identified model type packaged in app.

  • Creates FritzManagedModel from a packaged MLModel with BaseIdentifiedModel extension. Used when model is included in application package.

    Declaration

    Swift

    @objc(initWithIdentifiedModel:)
    public convenience init(identifiedModel: BaseIdentifiedModel)

    Parameters

    identifiedModel

    Included MLModel class.

  • Creates FritzManagedModel from a packaged MLModel with BaseIdentifiedModel extension. Used when model is included in application package.

    Declaration

    Swift

    @objc(initWithIdentifiedModelType:)
    public convenience init(identifiedModelType: BaseIdentifiedModel.Type)

    Parameters

    identifiedModelType

    Type of conformed model.

  • Deletes all state relating to managed model version.

    This removes all downloaded versions for this model identifier and any cached server values for it.

    Declaration

    Swift

    public func delete() throws