TIOModelBundleManager

@interface TIOModelBundleManager : NSObject

The TIOModelBundleManager manages model bundles in a provided directory. Use the returned TIOModelBundle classes to instantiante TIOModel objects.

Usage: @code [TIOModelBundleManager.sharedManager loadModelBundlesAtPath:modelsPath error:&error]; TIOModelBundle *bundle = [TIOModelBundleManager.sharedManager bundleWithId:@model-id]; id model = [bundle newModel]; @endcode

  • All available model bundles.

    You must call loadModelBundlesAtPath:error: before accessing this property.

    Declaration

    Objective-C

    @property (readonly, atomic) NSArray<TIOModelBundle *> *_Nonnull modelBundles;

    Swift

    var modelBundles: [TIOModelBundle] { get }
  • Returns the shared instance of the TIOModelBundleManager. You may create your own model managers if you require more than one.

    Declaration

    Objective-C

    + (nonnull instancetype)sharedManager;

    Swift

    class func shared() -> Self
  • Loads the available models at the specified path, e.g. folders that end in .tfbundle and assigns them to the models property. Models will be sorted by name by default.

    Declaration

    Objective-C

    - (BOOL)loadModelBundlesAtPath:(nonnull NSString *)path
                             error:(NSError *_Nullable *_Nullable)error;

    Swift

    func loadModelBundles(atPath path: String) throws

    Parameters

    path

    Directory where model bundles are located, may be in the application bundle, application documents directory, or elsewhere.

    error

    An error if the model bundles could not be loaded.

    Return Value

    BOOL YES if the bundles were successfully loaded, NO otherwise.

  • Returns the models that match the provided ids.

    You must call loadModelsAtPath:error: before calling this method.

    Declaration

    Objective-C

    - (nonnull NSArray<TIOModelBundle *> *)bundlesWithIds:
        (nonnull NSArray<NSString *> *)modelIds;

    Swift

    func bundles(withIds modelIds: [String]) -> [TIOModelBundle]

    Parameters

    modelIds

    Array of model ids in NSString format

    Return Value

    NSArray Array of TIOModelBundle matching the model ids

  • Returns the single model that matches the provided id.

    You must call loadModelsAtPath:error: before calling this method.

    Declaration

    Objective-C

    - (nullable TIOModelBundle *)bundleWithId:(nonnull NSString *)modelId;

    Swift

    func bundle(withId modelId: String) -> TIOModelBundle?

    Parameters

    modelId

    The single model id whose bundle you would like.

    Return Value

    TIOModelBundle The model bundle matching the model id.