MimiSDK 10 Migration Guide

MimiSDK 10 brings about significant improvements to the Processing APIs. In addition to removal of certain unnecessarily complex APIs, a top-level Processing Configuration API has been introduced which wraps the lower-level Processing APIs.

This document outlines the various changes required to migrate to MimiSDK 10 from a previous version of MimiSDK.

Requirements

  • iOS 15 or above.
  • Xcode 15.
  • Swift 5.9

API Changes

MimiSDK 10 introduces several API-breaking changes that should be made aware of. These changes are documented in the Changelog.

Processing API & Swift Concurrency

Several parts of the Processing API were rewritten to use Swift Concurrency in order to make the code more thread-safe and to take the advantage of the powerful modern Concurrency APIs.

Most of the Mimi Processing API types have been changed from Classes to Actors which makes them safer. The method return types that previously relied on Combine Publishers have now been rewritten to use the Swift async await. Check the Integrating Processing guide for more information and examples.

Processing Configuration API to activate Processing

A higher-level and more declarative Configuration API can now be used to activate a Processing session. See the Activation section in the Integrating Processing guide for more information on the Configuration API.

// Before
do {
    let fitting = MimiPersonalization.Fitting.techLevel(4) // An example fitting, yours will be defined by the Mimi Processing system on the device.
    let presetDataSource = MimiUpDownPresetParameterDataSource(fitting: fitting)
    let session = try MimiCore.shared.processing.activate(presetDataSource: .upDown(presetDataSource))
} catch {
    // Handle activation failure
}
// After
do {
    let fitting = MimiPersonalization.Fitting.techLevel(4) // An example fitting, yours will be defined by the Mimi Processing system on the device.

    let configuration = mimiProcessingConfiguration {
                            Personalization {
                                FineTuning(fitting: fitting)
                            }
                        }
    let session = try await MimiCore.shared.processing.activate(configuration: configuration)
} catch {
    // Handle activation failure
}

Removed canApply method in MimiProcessingParameterApplicator

The canApply method used in the MimiProcessingParameterApplicator has been removed. This was done as the canApply check was essentially redundant, as any such check could be performed in the apply function itself and having two separate functions for this was confusing.

If you were previously using canApply to check if a value could be applied, you should now perform this check in your apply method implementation.

// Before
let applicator = parameter.applicator()
    .canApply { value in
        // Verify if value can be applied
        return true // or false
    }
    .apply { value, result in
        // Apply the value and execute result handler
        result(.success) // or result(.failure(error))
    }
// After
let applicator = await parameter.addApplicator { value in
    // Apply the value or throw an error. 
}

Replaced deliveryMode property in MimiProcessingParameter with uiControlDebounceBehavior property in MimiPersonalizationConfiguration

The deliveryMode property in MimiProcessingParameter has been removed.

Since deliveryMode is closely coupled with the user interface, we decoupled it from the MimiProcessingParameter. We have now added a new debounce behavior property uiControlDebounceBehavior which can be set in MimiPersonalizationConfiguration available through the top-level MimiProfileConfiguration. This debounce behavior is applied to the Processing UI controls on the Mimi Profile.

Removed applicator(synchronizing value:) method in MimiProcessingParameter

Since a synchronizing value can be applied on the parameter directly through the MimiProcessingParameter.apply(:) function, the .applicator(synchronizing value:) is rather redundant in terms of functionality.

Added synchronizeApplicators() in MimiProcessingParameter

The synchronizeApplicators() function attempts to update all registered MimiProcessingParameterApplicator instances that are currently out-of-date with the current value of the MimiProcessingParameter.

Added updateState in MimiProcessingParameter

A publisher for tracking state changes related to the MimiProcessingParameter.

Example usage:

   // Subscribe to states changes of the isEnabled processing parameter
   let subscription = session.isEnabled.updateState
        .sink { state in
           print("isEnabled parameter update state: \(state)")
   }

Removed presetDataSource in MimiProcessingSession

The presetDataSource property in MimiProcessingSession has been removed. The preset data-source can now be accessed through the preset.dataSource property in MimiProcessingSession.

Removed deprecated Properties and Methods in MimiColor and MimiColorBook

As part of an earlier update, the MimiHighlightableColor type was introduced to address theming-related issues associated with optional highlighted colors. Using this type, the requirement for highlighted colors is now explicit when defining colors for a custom theme.